Posts

Showing posts from July, 2011

c# - Reading XML dynamic data in SQL Server -

i have xml column in table contains collection of data. every record may hold different collection type customers data , invoices data etc. how can read cell & convert table in order bind data grid, collection times looks that <arrayofreceipttransfer_receipt xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <receipttransfer_receipt> <receipttransfer_receipt_id>77491</receipttransfer_receipt_id> <receipttransferid>17839</receipttransferid> <receiptid>74080</receiptid> <amount>500.00</amount> </receipttransfer_receipt> </arrayofreceipttransfer_receipt> and looks like <arrayofinvoicebudgetitem xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <invoicebudgetitem> <invoiceid>21978</invoiceid> <budgetitemid>1...

sql server - How to run sql query for each row value using set based approach -

i have following code placed inside cursor , have remove cursor due performance issue. trying use set based approach, have replace @originalvalue , @per_month variable sql query per set based approach @ same time need perform below calculation each row (with value of @originalvalue , @per_month ) if replacing @originalvalue , @per_month sql query select originalvalue , per_month tblreport reportdate = getdate() ", in case below mention code not yielding result in row manner. eg. cursor declared below records: originalvalue per_month ------------------------ 100 1 200 3 600 4 500 7 code: set @total = (@total * power(1 + (@value1 / 100.0), @originalvalue) + (@per_month / 100.0) * ( case when @originalvalue = 0 1 else case when (@value1 / 100.0)<> 0 (power(1 + (@value1 / 100.0), @originalvalue) - 1) / (@value1 / 100.0) * (1 + (@value1 / 100.0) * @method) else @origin...

c++ - Automatically Pass Parent Pointer to its Variables? -

this functionality have, wondering if there way able pass parent pointer it's variables without having = this ? struct location; struct parent { std::vector<location*> locations; }; struct location { location(parent* p) { p->locations.push_back(this); } }; struct specialparent : parent { location = this; location b = this; location c = this; location zabazoo = this; // etc }; the point of can still specialparent->zabazoo still batch process locations operations. location = b = c = zabazoo = this; the quick brown fox jumps on lazy dog.

xml creation using java -

i want iterate on xml given below: <annotation> <properties> <propertyvalue propertyname="field_label">label.modelseriescd</propertyvalue> <propertyvalue propertyname="containertype">conditioncontainer</propertyvalue> </properties> </annotation> i trying these codes: 1) while(currentnode.haschildnodes()){ system.out.println(currentnode.getnextsibling()); currentnode=currentnode.getnextsibling(); } 2) for (int x = 0; x < childnode.getlength(); x++) { node current = childnode.item(x); if (node.element_node == current.getnodetype()) { string cn = current.getnodename(); system.out.print(cn +" = "); str...

ios - Defining a new interface causes "Undefined symbols for architecture x86_64:". Existing interfaces work fine -

i have ios app , using xcode version 6.3.1 (6d1002). have m file in define @interface customobject:nsobject {} @end and try use in viewdidload as customobject* obj = [[customobject alloc]init]; when run this, linkage errors saying undefined symbols architecture x86_64: "_objc_class_$_customobject", referenced from: objc-class-ref in choosealbumviewcontroller.o ld: symbol(s) not found architecture x86_64 i have similar interfaces defined other objects , continue build, link , run fine. new interfaces i'm defining failing these linkage errors. use figure out what's causing this. i'm new ios development if i'm missing information crucial figure out please let me know , i'll add it. few flags build settings might - build active architecture = yes architectures = standard architecture armv7 armv64 valid architectures = arm64 armv7 armv7s here code in define interface , try use it @interface customalbum : nsobject {...

android - How to share texts and translations across mobile apps? -

we support english, german, spanish, italian, , french languages. have an ios, android, , windows phone app, , html/js webapp . 3 mobile apps similar. have same screens , texts. each app done small team , features developed apps in parallel. quite few texts used in webapp. we facing problem of how manage our (english) text strings , translations . right now, have google documents tables show screen drafts , corresponding english texts , translations. coordinate translation efforts email , comments in documents. we looking translation tools (namely transifex). appreciate things translation memory, glossary, , easy integration sw development workflows. these tools not fulfill 2 basic requirements have: sharing same texts (source language , translations) across apps, if source text or translation changes, change propagated apps. grouping texts screens , showing screen drafts while translating give context developer. therefore started thinking whether looking more a (tex...

Wizard link Target not rendering in front - Fluid/Extbase typo3 -

http://screencast.com/t/l3asbi2e - wizard link target not rendering in front front side code title but target not rendering afaik f:link.page viewhelper not interpret typolinks (that have). you should use viewhelper does, example v:link.typolink viewhelper extension vhs . you'd use this: {namespace v=fluidtypo3\vhs\viewhelpers} <v:link.typolink configuration="{parameter: youvariablehere}">linktext</v:link.typolink>

domain driven design - Should Nancy modules be DDD app services? -

i've used nancy web framework in few projects already. of developed using domain-driven design. my current approach what did in these application following: use nancy modules define http endpoints (obviously). call application service (implemented in class) module carry out application logic defined ddd. take return value app service call (e.g. dto or view-model) , format appropriately (e.g. convert json or render in view. the reason why separated nancy module app service have "clean" app services, i.e. dependencies injected through constructor, no logic in constructor , no mutable state. also, dynamic stuff restricted modules. note goal of approach explicitly not make app services web-agnostic. problems (or rather code smells) the problem approach is not clear separation of concerns. in cases app service needs format response based on condition. or needs return specific http status code. stuff i'd rather in nancy module. question what prefe...

How to email the auto generated Email-able report of TestNG + Web driver using Java -

email-able report generated testng don't know how can email report prospective stakeholders. want through script in java using selenium web driver. if can in different way helpful. you need have smtp server, instead of writing separate code recommend integrate selenium webdriver jenkins has inbuilt mechanism circulating reports whomsoever want.

html5 - How to pass object in Thymeleaf + Spring flow without values -

from search page, user can click create new button. if user enter p_no in search page, , user click create new, number being carried out create new page. should not pass value. wrong code below. personentry.html(create page) : <form id="entry" action="#" th:object="${person}" method="post"> <div id="boxes"> <div class="col-md-1"> <input type="text" class="form-control" id="pno" th:value="${person.p_no}" disabled="disabled" /> </div> </div> </form> controller.java: @controller @requestmapping("/searchpersons") public class searchpersoncontroller { @requestmapping(value = "/createnewbtn", method = requestmethod.post) public modelandview creatnewperson(person person) { modelandview modelandview = new modelandview(); modelandview.setviewnam...

Multiple models to describe a rental process in rails -

i have two-sided rental marketplace , bookings have been described 1 model. stores status renter requesting, owner accepting / rejecting, booking finished etc. create_table "bookings" |t| # storing booking time info t.datetime "pickup_datetime" t.datetime "return_datetime" # create snapshots of state of product @ time of rental requests submission t.integer "hourly_rate" t.integer "weekly_rate" t.integer "daily_rate" # storing states t.datetime "requested_at" t.datetime "accepted_at" t.datetime "rejected_at" t.datetime "cancelled_at" t.datetime "created_at" t.datetime "updated_at" t.datetime "owner_reviewed_at" t.datetime "renter_reviewed_at" t.integer "renter_id" t.integer "product_id" end i found clumsy , decided break down 3 models rental::intent ->...

java - Spring @Value adding Validation less than -

i using following property value injection. how can add less validation operation. mean want set validation user.maxpassiveday property value has not less 100 lets say. @value("${user.maxpassiveday}") int maxpassiveday; using spring 3.1.1 version you can use @value on setter method: int maxpassiveday; @value("${user.maxpassiveday}") public void setmaxpassiveday(final string maxpassiveday) { int tmp = integer.parseint(maxpassiveday); if (tmp < 100) { this.maxpassiveday = tmp; } }

java - How to retrieve,update,delete data from database using DAO method in Hibernate -

how retrieve,update,delete data database using dao method in hibernate. my dao this: package com.sample.common.impl; import java.util.list; import com.sample.common.employee; public interface employeedao { public list<employee> getallemployee(); public void updateemployee(employee emp); public void deleteemployee(employee emp); } my implementation class this: package com.sample.common.impl; import java.util.arraylist; import java.util.list; import org.hibernate.sessionfactory; import com.sample.common.employee; public class employeedaoimpl implements employeedao { private sessionfactory sessionfactory; public list<employee> getallemployee() { return null; } public void updateemployee(employee emp) { } public void deleteemployee(employee emp) { } } how create query select,update , delete. can please suggest possible solution you have update code below public void deleteemployee(employee emp) { ...

Unable to understand this concept of handlers in c++ -

i going through piece of code when came across new. tried write own code better understanding. #include<iostream> using namespace std; class material { public: material() { cout<<"material() called"<<endl; } bool test_func() { cout<<"hello world"<<endl; return true; } }; class server { private: material *mat; public: server() { cout<<"server() called"<<endl; } material *matrl() { return mat; } }; class handler { public: handler() { cout<<"handler() called"<<endl; } server svr; bool demo() { bool ret; ret=svr.matrl()->test_func(); return ret; } }; int main() { handler h; cout<<"returned demo():"<<h.demo()<<endl; return 0; } even getting desired output, is: server() called handler() called hello world returned demo():1 but not able understand concept here : material *matrl() { return mat; } and fun...

how to get my while to update a string length in python -

i'm trying while loop working remove consonants front of input word, goes through once , finishes, how keep while loop going until consonants @ end of word (example: want "switch" "itch + sw" , to, once consonants moved, add "ay" @ end form "itchsway" here code far, i'm new python appreciated! print("pig latin translator test!") name = raw_input("what name?") if len(name) > 0 , name.isalpha(): print("hello!") else: print("that's not name!") word = raw_input("what word?") word0 = word[0] word0 = word0.lower() n = 0 if len(word0) > 0 , word0.isalpha(): word0proof = word0 else: print("that isn't word!") if word0proof in "aeiou": wordoutput = word + "yay" print (wordoutput) else: print("your word doesn't begin vowel") if word0proof in "bcdefghjklmnpqrstvwxyz": word1 = word0proof else: ...

eclipse - Giving input to Java through a batch file -

i developing application in users give input in batch file , batch file input given input eclipse , oy run java program(logic) , give output either through batch file or excel. in eclipse can set arguments using run > run configurations > arguments running jar file directly works simple: java -jar somefile.jar port ip whatever else those arguments passed main() method string[] , if want numbers have convert them. public static void main(string[] args) { system.out.println(args[0]); // port system.out.println(args[1]); // ip system.out.println(args[2]); // whatever system.out.println(args[3]); // else }

javascript - Jquery | How can I make a custom function and call it? -

i think quality of question low appreciate guys give me solution. the part of code duplicated in 2 functions. want arrange long code short. below example want do. void duplicatedfunc() { //some logic } void func1() { duplicatedfunc(); } void func2() { //func2 logic here.. duplicatedfunc(); } how can in jquery ?? here jquery code. $("#inputlogo").change(function(){ $("#logofile div.notyet").remove(); var file = this.files[0]; var fr = new filereader(); fr.onload = (function (file) { return function(e){ var div = document.createelement("div"); $(div).addclass("notyet").css({ margin : "30px" ,position : "relative" }); var html = ['<i...

amazon web services - Saltstack: (boto_secgroup) Add a rule that allows ALL TRAFFIC to a sec group -

[using salt --version: 2015.5.0] want add rule allows traffic security group i have in pillar: securitygroups: groups: - name: nfs region: us-east-1 vpc_id: vpc-1234 description: desc rules: - ip_protocol: -1 from_port: -1 to_port: -1 ec2_group: sg123456 api suggests use -1 specify ipprotcol . i'm getting error: ---------- id: secgroups_nfsecuritygroup function: boto_secgroup.present name: nfsecuritygroup result: false comment: exception occurred in state: traceback (most recent call last): file "/usr/lib/python2.6/site-packages/salt/state.py", line 1563, in call **cdata['kwargs']) file "/usr/lib/python2.6/site-packages/salt/states/boto_secgroup.py", line 140, in present _ret = _rules_present(name, rules, vpc_id, region, key, keyid, profile) ...

c# - System.ArgumentNullException in System.ni.dll - Xamarin IIF like VB.net -

answering own question couldn't find solution problem online. error when running xamarin app using vs2013: an exception of type 'system.argumentnullexception' occurred in system.ni.dll not handled in user code it occurs on line: windevice: loadapplication(new app()); ios: uiapplication.main(args, null, "appdelegate"); android: loadapplication(new app()); you need make sure resources available, in case image missing: icon = device.os == targetplatform.ios ? "slideout.png" : null; i thought image resource wasn't necessary because not targeting ios platform. its reminiscent of vb.net's iif both sides evaluated (ie if statement not short-circuited).

mongodb - Meteor Text Search has no results? -

my webapp consists of list of topics , search field filter them with. i started inserting object mongodb : $meteor mongo meteor:primary> db.topics.insert({title:"hello world!"}); i wrote in .coffee file verify showed expected: topics = new mongo.collection "topics" if meteor.isclient template.body.helpers { topics: -> topics.find {} } that worked fine. decided move having fixed filter of "hello" . replaced topics.find {} with: topics.find {$text: {$search: "hello"}} this caused list appear empty. tried this: topics.find {title: {$text: {$search: "hello"}}} but did not work. missing here? (also, first time using coffeescript . generated javascript file looked right me, if see unnecessary punctuation or other bad habits in here, please point out me. tends python programmers, know how obnoxious people new language littering unnecessary semicolons.) update i have added in following serve...

wordpress - PHP Compare date to current date does not work -

this wordpress site dates custom , not post dates. i'm trying compare expire date current date. works on dates when expire date on 01/01/2017 or 01/01/2016 returns invalid status. when date on year 2017 still returns invalid status. somehow not consistent , not sure check , statement might missing. sample code. expired date stored in $dates[1] , value has format of mm/dd/yy. used wordpress current_time code call current date. please help. thanks! <?php $current_datetime = current_time( 'mysql' ); if ($dates[1] < date('m/d/y', strtotime($current_datetime)) ){ echo '<td class="-status"><span>invalid</span></td>'."\n"; } else if ($dates[1] >= date('m/d/y', strtotime($current_datetime)) ){ echo '<td class="-status"><span>valid</span></td>'."\n"; } ?> i figured out. format of date, year of date had problem. tho...

Cassandra 2.1 : User Defined Types - Achilles - Java Mapping -

how map user defined types in java using achilles java library in cassandra 2.1? particularly, implementation/example this link helpful. create type address ( street text, city text, zip int ); create table user_profiles ( login text primary key, first_name text, last_name text, email text, addresses map<text, address> ); to map user defined type in java using achilles , can use @udt annotation. in case , address bean : @udt(name="address",keyspace = "your_keyspcae_name") class address{ @column("street") private string street; @column("city") private string city; @column("zip") private int zip; //getter , setter methods . . . . } and main table mapping : @table(table="user_profile",keyspace="your_keyspace_name") class userprofiles{ . . . . @column("addresses") private map addresses; . . . . } ...

encapsulation - Should objects know about their users in certain cases? -

i'm laying out foundations potential game, i'm having trouble designing classes encapsulated yet efficient. generally, people objects should rely little on each other preserve modularity , encapsulation. however, seems convenient have object know each other. let's have class called dog. public class dog { public void eat() { ... } public void wagtail() { ... } } dogs have owners, there dog owner class. public class dogowner { private dog dog; public dog getdog() { return dog; } public void petdog() { ... } public void takedogforwalk() { ... } } now, if have dog , don't have owner? seems make sense make getowner() method dog . public class dog { private dogowner owner; public void eat() { ... } public void wagtail() { ... } public dogowner getowner() { return owner; } } however, gives dog information dogowner , seems violate information hiding. seems create redundancy, because dog has dogowner , , dogowner has dog . ...

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

there several posts converting mat bitmap using utils.mattobitmap() function. i'm assuming function can called in java layer after importing utils class. i want transfer data memory address pointed uint32_t* bmpcontent; in code below. jniexport void jnicall java_com_nod_nodcv_nodcvactivity_runfilter( jnienv *env, jclass clazz, jobject outbmp, jbytearray indata, jint width, jint height, jint choice, jint filter) { int outsz = width*height; int insz = outsz + outsz/2; androidbitmapinfo bmpinfo; if (androidbitmap_getinfo(env, outbmp, &bmpinfo) < 0) { throwjavaexception(env,"gaussianblur","error retrieving bitmap meta data"); return; } if (bmpinfo.format != android_bitmap_format_rgba_8888) { throwjavaexception(env,"gaussianblur","expecting rgba_8888 format"); return; } uint32_t* bmpcontent; if (androidbitmap_lockpixels(env, outbmp,(void**)&bmpcontent)...

Spring Cloud AWS SQS AccessDenied -

i having connection issue trying connect aws sqs queue using spring cloud , spring boot. believe have configured fine getting: 2015-07-01 18:12:11,926 [warn][-] org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext[487] - exception encountered during context initialization - cancelling refresh attempt org.springframework.context.applicationcontextexception: failed start bean 'simplemessagelistenercontainer'; nested exception com.amazonaws.amazonserviceexception: access resource https://sqs.us-west-2.amazonaws.com/ {number}/{queue name} denied. (service: amazonsqs; status code: 403; error code: accessdenied; request id: 87312428-ec0f-5990-9f69-6a269a041b4d) @configuration @enablesqs public class cloudconfiguration { private static final logger log = logger.getlogger(cloudconfiguration.class); @messagemapping("queue") public void retrieveprovisionmessages(user user) { log.warn(user.first...

Linux: C++ Abstract class as shared object API -

i read this article on c++ dll api-s. "c++ mature approach: using abstract interface" work on linux different compilers (exe , .so compiled different compilers)? couldn't find online confirms/denies linux systems. in article author says works windows because com technology works other compilers. to understand question please read @ least "c++ mature approach" chapter of article. yes , no. there's no guarantee different compilers implement virtual function calls in returned interface class in same way - , if case fail catastrophically (or silently corrupt stuff ... more fun). if recal correctly - modern g++, clang , intel on linux seem handle same way , should interoperable @ level. however there's further gotcha not mentioned in article, , applies both linux , windows. if take approach only things can pass interfaces simple types int types control in memory layout. this means cant have function in interface void withvector(st...

Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class View -

i trying instantiate object of type application outside of wrote static main method , getting exception. public class main { public static void main(string[] args) { new view(args); } } import javafx.application.application; public class view extends application { public view(string... args) { launch(args); } @override public void start(stage primarystage) throws exception { } } the stack trace: exception in application constructor exception in thread "main" java.lang.runtimeexception: unable construct application instance: class view @ com.sun.javafx.application.launcherimpl.launchapplication1(launcherimpl.java:907) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication$152(launcherimpl.java:182) @ com.sun.javafx.application.launcherimpl$$lambda$2/1867083167.run(unknown source) @ java.lang.thread.run(thread.java:745) caused by: java.lang.reflect.invocationtargetexception @ sun.reflec...

css - How to make element appear 2nd in two-column layout and 3rd when stacked with Bootstrap 3 -

i've got following layout using bootstrap : [1][2] [3] it stacks in 1 column on handheld devices this: [1] [2] [3] i need stack this: [1] [3] [2] how done? there feature in bootstrap called column ordering . here working example needs: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="row"> <div class="col-sm-5 "> content 1 </div> <div class="col-sm-5 col-sm-push-5"> content 3 </div> <div class="col-sm-2 col-sm-pull-5"> content 2 </div> </div> </div>

java - Getting hash parameters from request url -

i have such url - http://www.coolsite.com/daily-plan/#id=1 easiest way parse string , read hash value (the value after #id=)? thank you on client side (i.e. javascript) can check window.location.hash hash. on server side, general answer 'it impossible' since hash not sent in request server. upd: maybe misunderstood question. answer how hash part of url either in browser or in server side code during request processing, not string processing. upd2: answer comment here because doesn't fit in comment. how work when user clicks on navigational links? i assume hash changed , corresponding content downloaded via ajax request web service or rest. for example if user has url www.example.com in browser , page shows list of product categories. user clicks 1 category , url changes www.example.com/#id=5 , products category(with id=5) downloaded via ajax , shown on page. no postback, partial page refresh. is close scenario? now want user paste/enter www.ex...

batch script to rename a file with string (with space) from variable -

there file named doctitle.txt contains title. want use title rename file, name file.pdf, did: for /f "delims=" %%x in (doctitle.txt) set "doctitle=%%x" move file.pdf %doctitle%.pdf this works fine, if there no space in title string, i.e "documenttitle". fails if there space in title, i.e "document title". what done overcome issue? try: for /f "tokens=*" %%x in (doctitle.txt) set doctitle=%%~x move file.pdf "%doctitle%.pdf" that way, variable doctitle not surrounded quotes %%~ removes quotes. quoting for /? : %~i - expands %i removing surrounding quotes (")

mysql - SQL Pricing Tiers -

i have pricing lookup table in mysql need lookup right pricing based on transaction quantity. say example, have pricing table pricing , looks like: product quantity price prod1 1 4 prod1 10 3 prod1 100 2 prod1 1000 1 prod2 1 0.4 ... and have table called transaction contains sales data: product sales prod1 144 prod2 2 ... how can sales multiply right unit price based on quantity. likes: product sales quantity unitprice prod1 144 100 2 prod2.... i tried join 2 table on product don't know go there, thanks! one way price using correlated subquery: select t.*, (select p.price pricing p p.product = t.product , p.quantity >= t.quantity order p.quantity limit 1 ) price transaction t; a similar subquery can used other information such pricing tier. for performance, want index on pricing(produ...

php - Object reference not set to an instance of an object on https soap call -

getting below error when trying make soap call using https. below code. have tried different ways around no luck. link http://dev.jp-websolutions.co.uk/teletrac/getsafetydata/test error i'm seeing soapfault exception: [soap:receiver] server unable process request. ---> object reference not set instance of object . this i'm using right now. header("content-type: text/plain"); $params = array( "username" => "xxx", "password" => "xxx", ); $opts = array( 'ssl' => array('ciphers'=>'rc4-sha') ); ini_set("soap.wsdl_cache_enabled", "0"); $client = new soapclient("https://onlineavl2dev-uk.navmanwireless.com/onlineavl/api/v1.3/service.asmx?wsdl", array('trace' => 1, 'soap_version' => soap_1_2, "encoding"=>"iso-8859-1", 'stream_context' => stream_context_create($opts))); #print_r($client...

c# - MSBuild run XSD Task before files get compiled -

i'm pretty new msbuild , trying xsd task run c# files need run app refreshed each time run build. i've got build task working following. <usingtask taskname="xsd" assemblyname="microsoft.build.cpptasks.common, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"/> <target name="generatecsfromxsd" beforetargets="build"> <itemgroup> <xsdinput include="xml\file1.xsd"/> <xsdinput include="xml\file2.xsd"/> </itemgroup> <xsd generatefromschema="classes" language="cs" sources="@(xsdinput)" /> </target> this works fine. each time run build regenerate new c# file file1 , file 2 inputs. issue if delete file1 , file2.cs files repo, , run build, build fail because reason files xsd task making not generated @ time looks source files compile. i thought beforetargets="build" cause files generated before di...

Giving a PHP CLI process a process name -

for project working on, spawning multiple amount of worker processes. thing is, don't appear in apple's activity monitor, because don't have proper title set. i tried use cli_set_process_title function available since php 5.5. unfortunately, xdebug pins me console: warning: cli_set_process_title(): cli_set_process_title had error: not initialized correctly in /users/ingwie/work/bird3/php-lib/yii_worker.php on line 22 call stack: 0.0012 264080 1. {main}() /users/ingwie/work/bird3/php-lib/request_handler.php:0 0.0286 1219016 2. workerman\worker::runall() /users/ingwie/work/bird3/php-lib2015-07-01t20:12:03.185z - info: bird3 worker@41603 online! /request_handler.php:103 0.0315 1252488 3. workerman\worker::forkworkers() /users/ingwie/work/bird3/php_modules/walkor/workerman/worker.php:328 0.0507 1254312 4. workerman\worker::forkoneworker() /users/ingwie/work/bird3/php_modules/walkor/workerman/worker.php:748 0.0561 1252896 5...

c# - Load data to a datagrid using another form -

i have 2 forms. 1st 1 frmstudentdetails. has datagrid 2nd 1 frmstudentregistration. has text boxes , add button when user enter information , press "add" button, want add datagrid 1 one for accomplish 1st created following method in frmstudentdetails public void addrecord(string stid, string name) { datagridviewrow row = (datagridviewrow)dgvstdetails.rows[0].clone(); row.cells[0].value = stid; row.cells[1].value = name; dgvstdetails.rows.add(row); } i called on frmstudentregistration form's add button --> private void btnadd_click(object sender, eventargs e) { frmstudentdetailsform frm = new frmstudentdetailsform(); frm.addrecord(txtstudentid.text, txtstname.text); frm.showdialog(); } then problem is, itz generating new forms show every new record. want add records in 1 form. please me that in "frmstudentregistration" class, add "public frmstudentdetails...

c# - How do I handle var (or ref) parameters in COM Interop? -

i have stand-alone application exposes com interfaces/coclasses/enums, etc. 1 of interfaces exports following function: procedure findtask(const taskid: widestring; var task: olevariant); safecall; note: task exposed coclass . note: task [in, out] so far, legacy application, written in delphi, had been able communicate stand-alone application. consider stand-alone app out-of-proc com server , consider legacy app client app. as rewriting old delphi app (client) in c#, have use com interop in c# communicate application. therefore, made use of tlbimp.exe translate com interfaces c# interfaces. that method translated following: void findtask(string, taskid, ref object task); how can call findtask , receive result of existent task signature? i've tried this: (task coclass type) sctask target = new cstask(); scheduler.findtask("a guid value", ref target); but compiler yelled type, since there no overload class type (the translated method receives obje...

javascript - AngularJS : Scope value changing, but doesn't always apply ng-class -

i'm working on creating 'pretty' checkboxes , radio boxes in angular. have similar plugins developed in jquery, i'm having trouble angular versions, checkbox. what i've done create directive (prettycheckbox) , template div wrapping checkbox input: <div class="prettycheckbox" ng-click="togglecb($event)" ng-class="{ 'checked': checkbox }"> <input id="{{inputid}}" type="checkbox" ng-model="checkbox"> </div> as can see, model value checked, changes div class checked, when not, not. input given display: none; , looks good. when designed it, set work label's attribute, , ok. then remembered can wrap input label, , clicking label should trigger input. tested code on it, , became super buggy. saw scope watch , console logs had setup see variable triggered 3 times every 1 click on div-checkbox, , twice when clicking labels, , 1 of each of these times wouldn't change...

JavaScript: Key event doesn't fire if selected text is just removed -

i applying handlers events keypress, keyup , keydown occuring on textarea. works every case except if select text , press backspace . particular assigned function won't called. if press backspace once more on textarea, function called. here code: function myfunc(f) { console.log("fired"); // logged when select , remove var h = f.target || f.srcelement || this; myfunc2(f); // doesn't called when select , remove } function myfunc2(e) { var $elem = $(e); // important stuff }; $textarea.addeventlistener("keyup", myfunc); $textarea.addeventlistener("keydown", myfunc); $textarea.addeventlistener("keypress", myfunc); myfunc({ target: $textarea }); // <-- call explicitly manage stuff the complete code function elasticize(a) { var b = "overflow" + ("overflowy" in document.getelementsbytagname("script")[0].style ? "y" : ""), e = function (h, g, j) { ...

ruby on rails - Active record "date" and "nationality" function giving me error. (Undefined method) -

i trying create profile page can input "born_on". using class createwinemakers < activerecord::migration def change create_table :wine_makers |t| t.string :name t.date :born_on t.text :nationality t.text :profile t.text :wine t.integer :wine_list_id t.timestamps end add_index :wine_makers, :wine_list_id end end here view file. <%= simple_form_for winemaker.new |f| %> <%= f.input :name %> <%= f.input :profile %> <%= f.input :wine %> <%= f.input :born_on %> <br/> <%= f.submit "create", :class => 'btn btn-primary' %> <% end %> the "born_on" giving me error saying method not defined. confused since other inputs working except "born_on" , "nationality". before, "born_on" named "birth_date", , thought naming convention wrong , changed "born_on". ...

reactive programming - RXJava Android - Observable result needed to create another observable -

i cant find way combine or chain list of observables it´s responses prerequisites other call creates observable. i´m using retrofit observables. my service: string url = "/geocode/json?sensor=false"; @get(url) observable<geocoderesult> getreverse(@query("key") string gmapskey, @query("latlng") latlng origin); and service needs geocoderesult @post("/api/orders") observable<order> createorder(@body geocoderesult neworder); and i´m trying with: // prerequisite 1 observable geocodeobservable = address.get(...); // call createorder after geocode obtained? return observable.combinelatest(geocodeobservable, geocode -> createorder(geocode)); but don´t work because combinelatest needs object, not observable need return observable. with joinobservable: pattern5<geocode> pattern = joinobservable.from(geocodeobservable) plan0<observable<order>> plan = pattern....

excel - Check sheet names to avoid duplicates -

i working on macro, part of takes input user asking he/she rename sheet. works fine, run runtime error if name provided user being used different sheet. understand why error occurs not sure how warn user , handle error. my code follows:- 'change sheet name dim sheetname string sheetname = inputbox(prompt:="enter model code (eg 2sv)", _ title:="model code", default:="model code here") wscopyto.name = sheetname there 2 ways handle this. first, trap error, check if there error, , advise, put error trapping was dim sheetname string sheetname = inputbox(prompt:="enter model code (eg 2sv)", _ title:="model code", default:="model code here") on error resume next err.clear 'ensure unhandled errors not give false positive on err.number wscopyto.name = sheetname if err.number = ?? 'go , ask name on error goto 0 second, check current sheet names, , see if there match dim sheetname str...

java - Why is my message printing twice when I break out of the inner if? -

i having little problem code. compiling , running works well, however, when attempt break out of inner loop, system.out.println("type category want add to."); system.out.println("homework, classwork, labs, test, quizzes, midterm, final"); the code above printing twice terminal when want print once. i have feeling simple mistake way brackets aligned having difficulty figuring out how it. appreciated! import java.util.scanner; public class getgrade { public static void main(string[] args) { scanner input = new scanner(system.in); final int max = 15; int[] homework = new int[max]; int[] classwork = new int[max]; int[] lab = new int[max]; int[] test = new int[max]; int[] quizzes = new int[max]; int[] midterm = new int[max]; int[] fin = new int[max]; int hwcount, clcount, labcount, testcount, quizcount, midcount, fincount; double hwtotal, cltotal, labtotal, testtot...

nuget - Build using TeamCity: Failed to start MSBuild; please specify a nuspec or project file to use -

i'm trying build website in teamcity, first build step "starting msbuild" failing.it seems command trying install nuget, complaining there no nuspec or project file specified . i have "nuget.targets" file , code compiles fine outside of teamcity , think must setting missing, , not file need add maybe need add nuspec or project file? assuming do, how go doing that? [exec] c:\teamcity\buildagent\work\61cf1fbc18b86c6f\.nuget\nuget.targets (109, 9): please specify nuspec or project file use. i new teamcity (~3hrs); how resolve problem? if build fails or behaves differntly in teamcity locally, recommended run build in working folder on agent machine under same user agent running. find more details here .

magento 1.9 - modify sitemap generatexml -

i looking limit product pages sitemap.xml file. i have extended mage_sitemap_model_sitemap class , rewrote generatexml() function, using magento ce 1.9.0.1 i have modified $collection = mage::getresourcemodel('sitemap/catalog_product')->getcollection($storeid); to this $collection = mage::getmodel('catalog/product')->getcollection($storeid)->addattributetofilter('visibility', 4); yet when sitemap generated, provides $baseurl in outputted sitemap. is there missing? code below....... /** * generate products sitemap */ $changefreq = (string)mage::getstoreconfig('sitemap/product/changefreq'); $priority = (string)mage::getstoreconfig('sitemap/product/priority'); $collection = mage::getmodel('catalog/product')->getcollection($storeid)->addattributetofilter('visibility', 4); foreach ($collection $item) { $xml = sprintf( '<url><loc>%s</loc><lastmod>%s</lastmod><...

serialization - Casting Character to char and char to Character Java -

can please explain me why code working fine? import java.io.*; public class array { public static void main(string[] args) throws ioexception, classnotfoundexception { fileoutputstream fo=new fileoutputstream("character.dat"); objectoutputstream oos=new objectoutputstream(fo); fileinputstream fi=new fileinputstream("character.dat"); objectinputstream ois=new objectinputstream(fi); character c = 'h'; oos.writeobject(c); character arr = (char)ois.readobject(); system.out.println(arr); fo.close(); fi.close(); oos.close(); ois.close(); } } in line 10, have created character , have serialized in line 11 , written file. in line 12, have deserialized object, returns reference of object , have downcast character . in line 12, downcasting char (which primitive data type , not class) , still working fine. why that? i think cast object char , assig...

linux - How can I detect a date from the content of a file using %F bash shell -

i have files have date inside , want check if content of file more current. can check comparison of dates cannot grep date file. example in file1 have: my name adelaide in lagos 9:29am (author)}||2015-03-13 13:12:59.239308|2012-07-09 10:00:00|reading|3110311|off internet |3012364|3012364|3012364|63613191| sectionstart file2 has: 63615595| summary|final|new roman; name if here earsprovider: ||2015-03-13 13:12:59.239308| summary 2012-07-09 09:00:00|2210299|3110311|2824032|o6550610|63615595| since not in conformity of table , file can have more 1 date format in it, want retrieve dates yyyy-mm-dd hh:mm:ss format. try gnu grep timestamps: grep -op '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-2][0-9]:[0-5][0-9]:[0-5][0-9](?=\|)' file

el - PropertyNotFoundException exception in the JSP page -

this question has answer here: javax.el.propertynotfoundexception: property 'foo' not found on type com.example.bean 2 answers i'm trying edit entity through jsp page <jsp:include page="menueditardisciplina.jsp"> <jsp:param name="iddisciplina" value='<%=request.getparameter("id")%>'/> </jsp:include> the servlet code i'm using public class inseredisciplina implements logica { private clienterestdisciplina clienterestdisciplina; private clienterestcurso clienterestcurso; public void executa(httpservletrequest req, httpservletresponse res) throws exception { clienterestdisciplina = new clienterestdisciplina(); clienterestcurso = new clienterestcurso(); string idcursos = req.getparameter("idcurso"); integer idcurso =...

javascript - Cannot initialize ng-model in JS rather than HTML -

html: ... <input ng-init="item.check=false" type="checkbox" ng-model="item.check"> ... <input ng-init="item.name=''" class="form-control" ng-model="item.name"> ... js: var myapp = angular.module('myapp', []); myapp.controller('appctrl', function ($scope, $http) { var refresh = function() { $scope.item.check = false; $scope.item.name = ""; } //call upon loading app initialize values, called upon events refresh field refresh(); i thought js sufficient initialize values , got rid of both checkbox , form's ng-init ended getting error: typeerror: cannot set property 'name' of undefined the app works if leave both ng-init. works when remove ng-init 1 of 2 elements (so either checkbox or form) not work if remove both. going on here? doing correctly or there better way initialize? thanks. you can add $scope.item = {} in first line of control...

javascript - Correct way of making POST request with JSON in SPRING MVC? -

i new spring , want correct way of making post request. have list of json object want post server example var list = [{name:"abc",age:23},{name:"xyz",age:22},{name:"xcx",age:33}] i making post request in google closure using xhr server in fashion model.xhrpost(id,url,"list="+json.stringify(this.list),callback); this controller looks like @requestmapping(value={"/getinput"}, method = requestmethod.post) @responsebody public string logclienterror(modelmap model, httpservletrequest request, httpservletresponse response) throws exception{ jsonobject result = new jsonobject(); try{ string errorobj = request.getparameter("list"); jsonarray errors = new jsonarray(errorobj); more code here loops through list... result.put("issuccess", true); return result.tostring(); }catch(jsonexception e){ result.put(...