Posts

Showing posts from August, 2012

php - Magento core controller extend query -

what happens when 2 different modules override same function , 1 govern behavior ex- have extended cartcontroller class have defined new deleteaction function, if module has same deletefunction the php autoloader priority (include_path) it tries in order: ./app/code/local ./app/code/community ./app/code/core so defined in local override community, regardless of internal magento rewrites.

php - Loop barcode generator error -

Image
i'm working barcode , using barcodephp library. it's working , want loop barcode , manage barcode position. problem seems library won't work when added echo "br" nor table. when added "br" or table barcode broke (won't show). here's result image: and here's code: require_once('layout/class/bcgfontfile.php'); require_once('layout/class/bcgcolor.php'); require_once('layout/class/bcgdrawing.php'); require_once('layout/class/bcgcode128.barcode.php'); // arguments r, g, , b color. $colorfont = new bcgcolor(0, 0, 0); $colorback = new bcgcolor(255, 255, 255); $font = new bcgfontfile('layout/class/font/arial.ttf', 18); $drawexception = null; try { $code = new bcgcode128(); $code->setscale(2); // resolution $code->setthickness(30); // thickness $code->setforegroundcolor($colorfont); // color of bars $code->setbackgroundcolor($colorback); // color of spaces $code-&

ruby - rails 4 select_tag in form doesn't get saved -

i have select_tag tag in simple form, this: <%= f.label :semester, "please select option:" %> <%= select_tag(:semester, options_for_select([['option one', "option one"], ['option two', "option two"], ['option three', "option three"], ['option four', "option four"]])) %> the controller function links form has nothing non-standard in , neither model relevant table. see correct parameter being sent when in heroku logs, field corresponding select_tag not being updated in database when people edit record. code seems fine me , have no idea mising @ moment. somehow using select_tag wrong? use <%= f.select(:semester, options_for_select([['option one', "option one"], ['option two', "option two"], ['option three', "option three"], ['option four', "option four"]])) %> you have forgot use form object why n

Where is the following function defined in the android source? -

i found following code in frameworks/base/telephony/java/com/android/internal/telephony/iphonesubinfo.aidl /** * retrieves serial number of icc, if applicable. */ string geticcserialnumber(); but cannot grep function geticcserialnumber(), know defined in source? i tried search on cyanogenmod's repository on github no luck. that function isn't function should implemented anywhere default. it's aidl method, if don't know check out: http://developer.android.com/guide/components/aidl.html basically, can understand interface. because interface, there may not implementation provided in android project.

php - Autoload namespaces based on directory structure -

according top comment on php page spl_autoload_register( ) : good news php 5.3 users namespaced classes: when create subfolder structure matching namespaces of >containing classes, never have define autoloader. <?php spl_autoload_extensions(".php"); // comma-separated list spl_autoload_register(); ?> however, when have following structure: * classes/someclass.php * index.php where someclass.php contains following: <?php class someclass { function __construct( ) { echo 'it works!'; } } ?> and index.php contains: <?php spl_autoload_extensions(".php"); spl_autoload_register(); new classes\someclass; ?> then following error: fatal error: spl_autoload(): class classes\someclass not loaded am getting wrong? how can make work? from comments this doesn't work either class: <?php namespace classes; class someclass {

Run a hava program from gradle as a part of another task -

i can run java program separate gradle task using javaexec type task: task (foo, type: javaexec) { main = '...' ... } however, how run java program part of task, in dolast ? can ant executor, there way more native gradle? you can define dependency dependson between tasks or can use javaexec method defined on project instance, see here . pseudocode: task t { dolast { javaexec { //logic goes here } } }

mongodb - java get field value -

{ "_id" : 0, "cityname" : "tallinn", "jan" : -3 } { "_id" : 1, "cityname" : "beijing", "jan" : -5 } { "_id" : 2, "cityname" : "berlin", "jan" : 12 } { "_id" : 3, "cityname" : "buenose", "jan" : 23 } i want calculate distance between tallinn other cities , beijing other cities continue entire document this java code try { basicdbobject query = new basicdbobject(); basicdbobject select = new basicdbobject(); select.put("jan",1); select.put("_id",1); dbcursor cursor = coll.find(query,select); basicdbobject obj = (basicdbobject)cursor.next(); int m,id; id=integer.parseint(obj.getstring("_id")); (int j=0;j<4;j++){ m= integer.parseint(obj.getstring("jan")); if (id==j){ while (cursor.hasnext()) {

r - Plot quantiles of distribution in ggplot2 with facets -

Image
i'm plotting number of different distributions of first differences number of regression models in ggplot. facilitate interpretation of differences, want mark 2.5% , 97.5% percentile of each distribution. since doing quite few plots, , because data grouped in 2 dimension (model , type), define , plot respective percentiles in ggplot environment. plotting distributions using facets gets me want except percentiles. of course more manually, ideally want find solution still able use facet_grid , since spared me lot of hassle trying fit different plots together. here's example using simulated data: df.example <- data.frame(model = rep(c("a", "b"), length.out = 500), type = rep(c("t1", "t2", "t2", "t1"), length.outh = 250), value = rnorm(1000)) ggplot(df.example, aes(x = value)) + facet_grid(type ~ model) + geom_density(aes(fill = model, colour = model)) i've

html - Jquery input validation dependent on checkbox value -

i trying avoid validation mess , using inline validation. have checkbox followed 3 input boxes. if checkbox checked, input fields have become "required". else not. here code: <div class="col-xs-12"> <div class="form-group"> <label class="checkbox-inline"> <input type="checkbox" id="vi" name="vi" checked="checked"> have apple </label> </div> </div> <div class="col-xs-6"> <div class="form-group"> <label>apple condition?</label> <input type="input" class="form-control" id="applecond" validate="required:'checkbox[name=vi][value=yes]:checked'"> </div> </div> <div class="col-xs-6"> <div class="form-group"> <label>so

shopify - Coss origin Error -

i'm getting following error in chrome not in firefox. headers i've used are: header("access-control-allow-origin: {$_server['http_origin']}"); header("access-control-allow-origin: * "); but i'm still stuck.the error getting follows- image origin ' https://www.example.com ' has been blocked loading cross-origin resource sharing policy: no 'access-control-allow-origin' header present on requested resource. origin ' https://example-app.myshopify.com ' therefore not allowed access.

php - Syntax error 1064 in SQL Query in selecting an id from database : Symfony -

i having error in sql query when try view profile of organiser: sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1 this controller function: public function viewprofileaction(request $request) { $em = $this->getdoctrine()->getmanager(); $orgid = $this->getuser()->getid(); $clicknblog = $this->get('adventure_bridge.clicknblog'); $trails= $clicknblog->matchtrails($orgid); $clicknblog = $this->get('adventure_bridge.clicknblog'); $event= $clicknblog-> getevents($orgid); $user = $this->getuser(); $memberid = $user->getid(); $role = 'bidorganiser'; $organiserdetails = $em->getrepository('adventurebiddingbundle:bidorganiser')->getorganiserbymemberid($memberid,$role); foreach($organiserdetails $organiser){ $count= $organiser->getcoun

Retrieve class from javascript self-invoking function -

i have function: (function(window, document,undefined) { 'use strict'; function test() { this.init = function() { console.log("init"); } }; return new test; })(window, document); i know class test accessible in context. want this: test.init(); if store 1 variable , this: var t = (function() {...})(); and console.log(t) return class itself , then, can retrieve it. don't want method i wondering, there way retrieve class javascript self invoking functions? how can achieve it, if possible? here's fiddle i'm working with: http://jsfiddle.net/grnagwg8/ regards, if want make global, within inline-invoked function (it's not self -invoking), assign property on window : (function(window, document,undefined) { 'use strict'; function test() { this.init = function() { console.log("init"); } }; window.test = new test; // <

php - URL Routing with get variables -

i want shorten url from: localhost/group.php?(get_request_variable_here) to localhost/(get_request_variable-value) essentially this: localhost/group.php?id=7 localhost/7 i using php , i'm guessing need htaccess file. this question has been asked on site lot. e.g. rewrite queries not need .php extension using mod_rewrite rewriterule but answer question. if using apache web server correct, need .htaccess file. work sufficiently: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ index.php [l] </ifmodule> this reroute requests not actual files index.php file. of course require implement routing logic in index file, determine page want access, how achieve pretty urls.

why am I getting out of bounds error in this linked list? C -

so making linked list. printing out. , reversing it. , printing out. first time make , print out. works fine. when reverse it. reverses successfully. when print it. go out of bounds though use same code did first. here reverse function void reverse_list(node_ptr* head){ node_ptr temp2; node_ptr temp3 = null; temp2 = (node_ptr)malloc(sizeof(node)); temp3 = (node_ptr)malloc(sizeof(node)); if (temp2==null || temp3==null) { printf("failed allocate node\n"); exit(1); } while (*head!=null) { temp2 = (*head)->next; (*head)->next = temp3; temp3 = (*head); (*head) = temp2; } *head = temp3; } here print function temp = head; while (temp != null) { printf("%d\n", temp->data); temp = temp->next; } reverse_list(&head); temp = head; while (temp != null) { printf("%d\n", temp->data); temp = temp->next; } for reason tries print garbage after last element do this: /* function r

filesystems - Not compiling the whole kernel only part of it -

my interest towards understanding linux kernel. filesystem. i'm doing is, i've placed "printk" statements in files(such inode.c, ialloc.c, etc.) in fs/ext3/ folder in kernel source code. so want instead of compiling whole kernel, want compile part concerned ext3 filesystem. there way compile part in have made changes in debian based systems (i'm using ubuntu 14.04). have wait whole kernel compile unnecessarily though i've made changes small part of it. please me in regard. p.s.- i've searched internet , found links too. not satisfactory. steps indicate compiling complete kernel instead. i have assumed have modified fs/ext3/inode.c suppose kernel source directory linux-x.x.x change directory cd linux-x.x.x to compile particular file make ./fs/ext3/inode.o only particular file compiled . same files have changed.

Reading a file with variable line lengths c++ -

i trying make program reads file line line. lines has variable lengths. here flow of program: first, prompt user enter number of line want view basing input user, output line. i thinking 2 ways implement this: i use getline() plus counter, once line, read it i use seekg jump position right away , read using getline.(not sure since seekg seeks position); i believe seekg ideal use, since faster reading line line (if possible want use seekg) . however, lines have different lengths , im not sure if possible seek lines easily. was wondering of give me suggestions. thanks use line function , reads complete line (till new line char '\n') #include< fstream> #include< string> using namespace std; int main (void) { string line; ifstream infile("infile.txt"); while (getline(infile,line)) { //process each line data here } }

java - How can I know if the curator InterProcessSemaphoreMutex was re-acquired after it was lost? -

i using interprocesssemaphoremutex curator recipe ensure application process singleton. mutex can lost because of transient network errors or application pausing (because of gc, example). using retry policy process can make attempt reacquire lock. want application process exit if unable re-acquire lock within (say) 5 minutes. the documentation recipe suggests can listen connectstatechange events. event lost indicates connection zookeeper has been lost , process lost lock well. way, process can detect if loses lock. how can process check if successful in re-acquiring lock? can't find method on mutex can give me information. suspiciously useful "isacquiredinthisprocess" method doesn't give me information. i not sure mean retrypolicy, of curator objects have retry policy ( distributedatomiclong example). i don't see how use interprocesssemaphoremutex , interprocesssemaphoremutex has acquire(long time, timeunit unit) method, using 5 minutes won

r - How to separate values in a column and add them in a new row? -

i have dataset follow: col1 col2 1,2,3 b ["1","2"] c 4 i want output as: col1 col2 a1 1 a2 2 a3 3 b1 1 b2 2 c 4 is possible in r? if yes, how? try library(splitstackshape) csplit(transform(df1, col2= gsub('\\[|\\]|"', '', col2)), 'col2', ',', 'long')[ ,col1:= if(.n>1) paste0(col1, 1:.n) else col1, col1] # col1 col2 #1: a1 1 #2: a2 2 #3: a3 3 #4: b1 1 #5: b2 2 #6: c 4 or using base r df2 <- stack(setnames(strsplit(gsub('[^0-9,]', '', df1$col2), ','), df1$col1)) df2$ind <- with(df2, paste0(ind,ave(seq_along(ind), ind, fun= function(x) if(length(x)==1) '' else seq_along(x)))) colnames(df2) <- paste0('col', 2:1)

java - ClassLoader.class.getResourceAsStream is not working in my code -

the below given code returning null when loading property file . kindly go through code , suggest me changes. constantprop = new properties(); try { // loads constants.properties file inputstream constantpropfile = classloader.class .getresourceasstream("/constantfiles/" + ".properties"); system.out.println(constantpropfile); constantprop.load(constantpropfile); } catch (filenotfoundexception e) { // todo auto-generated catch block // e.printstacktrace(); log.equals("constant property file not found"); } catch (ioexception e) { // todo auto-generated catch block // e.printstacktrace(); log.error("can't load constants.properties property file "); } if using method getresourceasstream describes: the search order described in documentation {@link getresource(string)}. an

java - MULE - Expression Transformer not substituting the flow variable value in expression -

i new mule , java , trying write generic flow transform payload value of flow variable set @ component level. below snippet of flow. how can use expression transformer generic. should execute value stored flow variable , manipulate payload. <flow name="process_incoming__eflow_messagesflow1" doc:name="process_incoming__eflow_messagesflow1"> <vm:inbound-endpoint exchange-pattern="request-response" path="transformtobod" doc:name="transfor bod vm"/> <logger message="message received bod vm #[payload]" level="info" doc:name="logger"/> <component class="com.efi.radius.components.getmessagetype" doc:name="java - type of bod comming payload"/> <logger message="the bod class trasform #[flowvars.messagetype]" level="info" doc:name="logger"/> <custom-transformer class="com.efi.radius.transformers.xmltobodt

How to embed YouTube videos in newer versions of Delphi? -

i'm trying load youtube video twebbrowser in delphi xe7 , i'm getting error says this: adobe flash player or html5 supported browser required video playback. get latest flash player learn more upgrading html5 browser i can load normal html fine. the examples i've found posted here earlier older versions of delphi, i'm wondering if issue newer versions, or twebbrowser, or in environment (vmware 7 windows 7). edit: objective able load , play video url, youtube video. solutions other twebbrowser fine, if can run cross-platform. you wondering whether problems relate delphi version. webbrowser control system control. delphi version not relevant because service provided underlying system. if has changed way tube delivers videos. if crafting html embeds remote video should follow latest documentation tube how should done. don't use years old delphi specific articles guide. use modern articles specific latest technology used tube. i have feeling, a

android - How to show the tab according to the day? -

i new android , making simple app show class routine. have used tabs show class schedule.now need show tab of current day without selecting tab manually? i.e. if today monday show class monfragment itself. this approach may help. switch (day) { case 0: actionbar.setselectednavigationitem(0); break; case 1: break; case 2: break; case 3: break; case 4: ............ default: break; }

c# - NHibernate ICriteria Return Empty Result -

i using nhibernate , creating query below :- icriteria criteria = session.createcriteria<payinoutbookentry>(); projectionlist projlist = projections.projectionlist(); projlist.add(projections.groupproperty("paymentoption").as("paymentoption")); criteria.setprojection(projlist); criteria.setresulttransformer(transformers.aliastobean<payinoutbookentry>()); ilist<payinoutbookentry> payinoutbookentrylist = criteria.list<payinoutbookentry>(); poco: public class payinoutbookentry { public virtual int payinoutbookentryid { get; set; } public virtual methodofpayment paymentoption { get; set; } } mapper: public payinoutbookentrymap() { table("payinout_bookentry"); schema("test"); lazy(true); id(x => x.payinoutbookentryid, map => { map.column("payinout_bookentry_id"); map.generator(generators.nativ

java - Accessing an array within an Object that consists of a string and the array -

my program has object class person . person object consists of string name (which name of person) , 6 element string array choices . array holds values user enters rank 6 different sports preferred least preffered. for example, person object called testperson consist of string set "bob" , array each element follows {3,1,4,2,5,6} . (the second sport listed bob's preferred sport , last sport listed least preferred). that example object can created following code: string[] temparray = new string[]{"3","1","4","2","5","6"}; person newperson = person("bob",temparray); here person class: public class person{ private string[] choices = new string[6]; private string name; //constructor public person(string myname, string[] myinput){ choices = myinput; name = myname; } //returns choices array public string[] getchoices(){ return(choices); }

xcode - Multiple Child Nodes in EnumerateChildNodesWithName -

i'm removing , adding nodes using enumeratechildnodeswithname. wondering if there way of using enumeratechildnodeswithname multiple names. example, @ moment using below: nodebase.enumeratechildnodeswithname("ground", usingblock: { node, stop in if node.position.x + positionx < -self.frame.size.width/2 - sizesegmentwidth/2 { node.removefromparent() } }) nodebase.enumeratechildnodeswithname("obstacle", usingblock: { node, stop in if node.position.x + positionx < -self.frame.size.width/2 - sizesegmentwidth/2 { node.removefromparent() } }) but i'm hoping (this doesn't work, example of i'm trying do): nodebase.enumeratechildnodeswithname("ground" || "obstacle", usingblock: { node, stop in if node.position.x + positionx < -self.frame.size.width/2 - sizesegmentwidth/2 { node.removefromparent()

How to cout middle zero with leading zero via one cout statement in C++? -

i need display 3 values parsed packet binary data(0x123400005678). unsigned int k = 0x1234, l=0x0, m=0x5678; i can display four-digit hex value when use cout 3 times. #include <iostream> #include <iomanip> ... cout << "seperated cout" << endl; cout << hex << setfill ('0') << setw (4) << k; cout << hex << setfill ('0') << setw (4) << l; cout << hex << setfill ('0') << setw (4) << m << endl; .... seperated cout 123400005678 but when use 1 cout line, leading 0 of '0x0' omitted... #include <iostream> #include <iomanip> ... cout << "oneline cout" << endl; cout << hex << setfill ('0') << setw (4) << k << l << m << endl; ... oneline cout 123405678 is there anyway display '123400005678' 1 line cout? or using cout 3 times way this? thank in ad

Android Studio error "installation failed since the device possibly has stale dexed jars" -

i formated computer , installed android studio before app working fine, after formating , installing android studio keep getting error "installation failed since device possibly has stale dexed jars" and in every emulator open "storage space running out!" although installed android studio , first time run app, not sure how got full? , not sure if reason dexed jars issue too any advise? thanks this worked me: in android studio can done clicking on build > clean project .

javascript - Copy HTML table structure to clipboard -

im looking advice on this. ive been looking trough internet possible solutions on how copy html table structure it's text clipboard no lucky far. what have @ moment simple table data , users need copy email using outlook , when copy/paste it. pasting manually outlook show table structure , text rendered correctly. issue users have several large tables making clumsy copy , scroll down @ same time reach bottom of page. so looking simple button automatically. looking find main div container , copy of table structures , text within user's clipboard. found popular solution called zeroclipboard copies text , not actual html table structure it. would know if possible accomplish jquery or other addons? appreciate advice on this. i don't think can trigger copy event button, suggestion workaround: clipboard api allows set custom data on copy event. listen copy event on table , send html text instead. user triggering copy event table html (or whichever text want

cakephp - order by timestamp DESC not working -

i have table called posts stores posts . has 2 columns "created" , "modified" . below query in model : $options = [ 'conditions' => [ 'circle_id' => $my_circle_list, 'team_id' => $this->current_team_id, 'modified between ? , ?' => [$start, $end], ], 'order' => ['modified'=> 'desc'], 'limit' => $limit, 'fields' => ['post_id'], ]; $res = $this->find('list', $options); now want latest edited posts on top , below mysql dump reads : select `post`.`id` `db`.`posts` `post` `post`.`id` in (125, 124) , `post`.`del_flg` = '0' order `post`.`modified` desc limit 20 if run query in database editor ,it gives correct output , in controller ordering changes again , figured

Creating Keyword/Tag System in FileMaker 14 -

i have filemaker 14 database of events. want able tag each event keywords. therefore, have created 3 tables, structured such: events ---< tags >--- keywords now, in order add keywords tags event, want make sure keyword has not been added , exists in tables of keywords. if doesn't exist, should created , added tag. in order implement this, thought have global field user enters keyword want. script following: enter keyword in global field set variable $eventid wtih id of current event set variable $keyword value global field check if $keyword present in keywords table if yes id of $keyword , put in variable $keywordid check if $keywordid tagged event if yes display message, "this keyword has been added event" if no create new record in tags table $keywordid , $eventid clear global field exit script if no create new record in keywords

ios - Error: Failed to set client format on recorded audio file (-66563) - EZRecorder / EZAudio -

i'm working on app uses ezaudio audio data microphone send on wifi, records received audio data on 2nd device. works great when tried use ezrecorder example file, error: " error: failed set client format on recorded audio file (-66563) ". should mention original example code works without issue on own error when move code project. any appreciated. here's piece of code causes this: -(void)togglerecording:(id)sender { if (rectest==0) { [recbutton setimage:[uiimage imagenamed:@"rec2.png"] forstate:uicontrolstatenormal]; rectest=1; } else if (rectest==1) { [recbutton setimage:[uiimage imagenamed:@"rec.png"] forstate:uicontrolstatenormal]; rectest=0; } self.playingtextfield.text = @"not playing"; if(self.audioplayer) { if(self.audioplayer.playing) { [self.audioplayer stop]; } self.audioplayer = nil; } if(rectest==

sql server - Can someone explain how to set up a foreign key for a table in C#? -

i working on project creating tables within database in c# , cannot figure out how create foreign key. here sql of trying create: create table factsalesorders (productkey int not null references dimproduct(productkey), customerkey int not null references dimcustomer(customerkey), salespersonkey int not null references dimsalesperson(salepersonkey), orderdatekey int not null references dimdate(datekey), orderno int not null, itemno int not null, quantity int not null, salesamount money not null, cost money not null constraint [pk_factsalesorders] primary key nonclustered ( [productkey],[customerkey],[salespersonkey],[orderdatekey],[orderno],[itemno] ) ) for example, trying set "references" part productkey in how references productkey column dimproduct table. here code have creating productkey column in facttable table: //creating fact table table facttable = new table(mydatabase, "fact table"

jsf - Interceptor Method Not Invoked -

the container glassfish. have implemented @postconstruct life-cycle event interceptor method in simple dao bean class, seems reason not intercepting business method @ all. not anywhere manually instantiate bean classes. beans.xml discovery mode , since don't annotate defaultuserdao bean, gets default scope. public class defaultuserdao implements userdao { private string username; private string password; scanner users = null; string[] usernamepasswordpairs = null; public defaultuserdao() { try { users = new scanner(paths.get("/home/nhuyvan1106/netbeansprojects/ejbinaction/web/users")); } catch (ioexception ex) { logger.getlogger(defaultuserdao.class.getname()).log(level.severe, null, ex); } } /*the interceptor method defined right below, interceptor method not called @ all. if insert system.out.println(usernamepasswordpairs) after split() method below, prin

entity framework - "Multiple object sets per type are not supported" error when trying to map data from two different tables to a single domain type -

i new entity framework , trying setup code first following table structure table: client 1. clientid int 2. name varchar(200) 3. company varchar(200) table: erpconnection 1. clientid int (foreign key client) 2. server varchar(100) 3. username varchar(100) table: erpadminconnection 1. clientid int (foreign key client) 2. server varchar(100) 3. username varchar(100) as can see there 1 one relationship between client->erpconnection , client->erpadminconnection. (note: did not design tables,but have use is) as can see not need 2 different types denote erp , erpadmin. so want create context this public class clientcontext: dbcontext { public dbset<client> clients{ get; set; } public dbset<connection> erpconnection { get; set; } public dbset<connection> erpadminconnection { get; set; } public clientcontext(string connectionstring) { this.database.connection.connectionstring = connectionstring; } } however, whe

How to get user data through twitter's Fabric API (Android) -

i've integrated twitter's fabric api in project twitter login button <com.twitter.sdk.android.core.identity.twitterloginbutton android:id="@+id/twitter_login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"/> a manifest permission <meta-data android:name="io.fabric.apikey" android:value="myfabrickey" /> initialization //field declerations private static final string twitter_key = "yourtwkey"; private static final string twitter_secret = "yoursecret"; //inside oncreate twitterauthconfig authconfig = new twitterauthconfig(twitter_key, twitter_secret); fabric.with(this, new crashlytics(), new twitter(authconfig)); loginbuttontwitter =

excel - calculating loop didn't work vba -

i trying calculate range m13:m22 using conditional values , looping, of code works in cell m13 , doesn't loop cell m22 . how solve problem? here code: private sub commandbutton1_click() dim pelanggan range, alamat range, diskon range, jdiskon range, tanggal range, jtempo range dim rout(1 10) variant, long dim path string path = "\\faizal\data d faizal\daftar harga\price list" filename = dir(path & "database.xlsx") set pelanggan = range("e7") set alamat = range("e8") set diskon = range("l25") set tanggal = range("l7") set jdiskon = range("p13") set jtempo = range("k30") getalamat = application.worksheetfunction.vlookup(pelanggan & range("j7"), workbooks("database.xlsx").worksheets("db").range("a6:n1350"), 14, false) getdiskon = application.worksheetfunction.vlookup(pelanggan & range("

auto vectorization - cython boundscheck=True faster than boundscheck=False -

consider following minimal example: #cython: language_level=3, boundscheck=false, wraparound=false, initializedcheck=false, cdivision=true cimport cython libc.stdlib cimport malloc def main(size_t ni, size_t nt, size_t nx): cdef: size_t i, j, t, x, y double[:, :, ::1] = <double[:ni, :ni, :nx]>malloc(ni * ni * nx * sizeof(double)) double[:, :, ::1] b = <double[:nt, :ni, :nx]>malloc(nt * ni * nx * sizeof(double)) size_t[:, :, ::1] best = <size_t[:nt, :ni, :nx]>malloc(nt * ni * nx * sizeof(size_t)) size_t mxi double s, mxs t in range(nt): j in range(ni): y in range(nx): # loops nothing needed effect below. mxs = -1e300 in range(ni): x in range(nx): cython.boundscheck(false): # faster!?!? s = b[t, i, x] + a[i, j, x] if s >= mxs: mxs =

performance - Javascript update time function causes high CPU -

i have following code using display current date , time, , want updated have setinterval update every second. seems causing page taking 25% of cpu , memory takes keeps climbing longer page up. is there can improve performance of this? jquery(function($){ (function update_time(){ var months = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; var days = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; var dt = new date(); var hr = dt.gethours() > 12 ? dt.gethours() - 12 : dt.gethours(); var mi = dt.getminutes() < 10 ? "0" + dt.getminutes() : dt.getminutes(); var sd = dt.getseconds() < 10 ? "0" + dt.getseconds

How to access DataSource object without 'java:/comp/env/' prefix in lookup method? -

since jndi resource named jdbc/mydb declared inside tomcat server/context.xml , can access datasource in following way: context initcontext = new initialcontext(); datsource datasource = (datasource)initcontext.lookup("java:/comp/env/jdbc/mydb"); is possible, config trick in .xml , by: datasource datasource = (datasource)initcontext.lookup("jdbc/mydb"); without java:/comp/env/ prefix in lookup method?

How to add an UIView on top of google map in iOS -

i trying place view on top of gmsmapview, when map dragged, view not move. tried use 'addsubview' , 'insertsubview', view did not show on top. know do? thanks! try this: [[[[uiapplication sharedapplication] delegate] window] addsubview:yourview]; yourview.layer.zposition = mapview.layer.zposition + 1; you may not have add view window, add map.superview , try adjusting zposition value above or maybe 1000 or something.

Adding rows to a swift array of my Schedule from a Detail View Controller won't work -

i have list of events each of them pass in data detail vc object core data model. example, event can have title, date, room, isfavorite, etc. now, detailvc , have "add schedule" button let user select favorite event attend. once clicked, save object array. i error1: cannot invoke append argument list of type string. detail view controller: class detailviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { var managedobjectcontext: nsmanagedobjectcontext? = nil // @iboutlet weak var detaildescriptionlabel: uilabel! @iboutlet weak var tableview: uitableview! //create new array hold on favorite objects (sessions add schedule) var favesarray = [event]() var detailitem: event! this detail view controller cellforrowatindexpath : func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { if indexpath.section == sections.info && indexpath.row ==

multithreading - Copying in Vectors to a Thread -

considering following code, wish have access both client , requests within thread, not: for _x in 0..100 { let handle = thread::spawn(move || { let start = time::precise_time_s(); let res = client.get("http://jacob.uk.com") .header(connection::close()) .send().unwrap(); let end = time::precise_time_s(); requests.push(request::new(end-start)); }); handle.join().unwrap() } i following compiler error: compiling herd v0.1.0 (file:///users/jacobclark/desktop/learningrust/herd) src/main.rs:41:23: 41:29 error: capture of moved value: `client` src/main.rs:41 let res = client.get("http://jacob.uk.com") ^~~~~~ src/main.rs:38:41: 48:10 note: `client` moved closure environment here because has type `[closure(())]`, non-copyable src/main.rs:38 let handle = thread::spawn(move || { src/main.rs:39

java - Jasper Dynamic Reports - using jasper reports to generate a report getting errors -

i want generate report database. working on jasper reporting tool , i'm getting following errors: exception in thread "main" java.lang.error: unresolved compilation problems: type cannot resolved centeredstyle cannot resolved variable type cannot resolved boldstyle cannot resolved variable type cannot resolved centeredstyle cannot resolved variable type cannot resolved centeredstyle cannot resolved variable type cannot resolved centeredstyle cannot resolved variable bigdecimal cannot resolved type centeredstyle cannot resolved variable @ project.reports.main(reports.java:36) code: package project; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; import net.sf.dynamicreports.jasper.builder.jasperreportbuilder; import net.sf.dynamicreports.report.builder.dynamicreports; import net.s