Posts

Showing posts from July, 2011

oracle - SQL Loader : Not enough values -

need debugging. table structure below : respond_by_date timestamp(6) , description varchar2(300) , axbcrule number(4) not null, segment varchar2(100) , assign_unique_balcon varchar2(1) , balcon_offer_type varchar2(3) , apr varchar2(10) , fee_yn varchar2(1) , fee_percent varchar2(10) , fee_amount_max varchar2(10) , balcon_duration_type varchar2(7) , balcon_duration varchar2(3) , balcon_cap_amount varchar2(10) , interim_apr varchar2(10) , interim_duration_type varchar2(7) , interim_duration number(3) , balcon_id number(7) , channel_id varchar2(7) not null , subchannel_id varchar2(7) not null , program_name varchar2(45) n

Should the physical path of an IIS Application match the virtual path? -

i understand physical path of application in iis not required live in same location reflected in virtual paths. of course, can done way. is considered bad practice have overlap? there negative consequences might occur doing this? here example: i have website @ c:\inetpub\wwwroot , deploy 2 applications: virtual paths: /apps/application1 /apps/application2 physical paths: c:\inetpub\wwwroot\apps\application1 c:\inetpub\wwwroot\apps\application2 alternative solution might this: virtual paths: /apps/application1 /apps/application2 physical paths: c:\inetpub\application1 c:\inetpub\application2 no, physical path not need match virtual path. it's totally how want set up.

c# - ErrorProvider with custom GetHashCode -

i have form responsible of creating (and saving) new patients. on form using errorprovider show error icons on invalid fields (in case "lastname"). so, usual => errorprovider.datasource = patient; everything works fine when model uses default gethashcode(). when try override method using custom hash code (i want use model iset collections) control not work properly. now, understand custom hash codes should used immutable objects. point is, how can fill fields of these objects if errorprovider behaviour relays on gethashcode work properly? necessary implement dirty mechanism switches between default hash code (during object initialization) , custom hash? code sample: public class patient : idataerrorinfo, inotifypropertychanged { public string lastname; public virtual string lastname { { return lastname; } set { if (lastname == value) return; lastname = value; notifypropertychanged("last

networking - how to get Global IP address? -

when pc connected network, getting couple of ip address. 1.) modem private ip address (will 192.168.1.3) 2.) isp address (by searching "my ip address" in google gives me global ip address) my roommate connected same modem able ping global ip address not other person connected different network, why?? is there anyway in isp block icmp packets?? no 1 able ping other machine ?? or use different routing instances different sectors?? if want global ip address pc can login/ping should enable?? your router/modem gets dynamic ip isp whenever connect internet. address name says changing. if want constant public ip isp, must request isp same. comes @ high cost , not recommended unless serving high revenue generating data on machine.

javascript - if i pre-render d3js charts on the server, how will their width/height be calculated? -

i have website sends 7 megs of json data client, d3 (actually dimplejs) charts rendered. page getting pretty slow , doesn't work in browsers. i'm thinking of rendering svg in server, instead of having client browser it. i've seen several references technique. however, since labels, bar widths , many elements depend pixel height , width of chart, , these dimensions not known until client's browser renders page, how people handle such issues? i'm not web/front-end developer don't know if i'm missing obvious or if assumptions wrong. the simplest thing take rendered <svg> , add viewbox attribute it. allows specify how want browser scale/stretch or crop <svg> when it's placed inside parent container (eg <div> ). anything beyond — selectively scaling or repositioning text or rects or axes — can achieved "hard" way; i.e. code has awareness of chart's semantics , programmatically alters svg attributes react c

Exception while reading password from a file as a Talend context variable -

Image
i have talend job reads context file , feeds context variables. have field called ftppassword , store hard coded password in context file. have context variable in job , refer in job. with setup job runs fine if change context file contain location password file instead of hard coded password, following exception: exception in component tftpconnection_1 com.enterprisedt.net.ftp.ftpexception: 530 login incorrect. @ com.enterprisedt.net.ftp.ftpcontrolsocket.validatereply(ftpcontrolsocket .java:11‌​79) @ com.enterprisedt.net.ftp.ftpclient.password(ftpclient.java:1844) @ com.enterprisedt.net.ftp.ftpclient.login(ftpclient.java:1766) – **edit - 2014-12-08 **** output of context parameters: implicit_context_context set key "ftphost" value "ftp.host.com" implicit_context_context set key "ftpport" value "21" implicit_context_context set key "ftpusername" value "myuser" implicit_context_context set key "ftppassword&quo

javascript - Why does an externally updated array not automatically refresh? -

i have js class handles logic, , trying use in angular can automatically update when value changes not work, when use angular functions works , reference ok, sure need else tell angular need listen when array changes externally. thanks! http://jsfiddle.net/9k2zw1ar/ //create class exposed window (function(w){ var foo=function(){ this.add=function(){ foo.arr.push('js-'+(math.random() * 100)); } } foo.arr=['a','b','c']; w.foo=foo; })(window); //instantiate 1 class , used in button var foo=new foo; //angular app var app= angular.module('app',[]); //add array reference using "value" app.value('arr',foo.arr); //angular controller app.controller('clientcontroller', ['$scope','arr', function($scope,arr) { $scope.markers = arr; $scope.add=function(){ arr.push('ng-'+(math.random() * 100)); }; }]); here html code <div ng-app="app&qu

google chrome - URL search through java program -

just quick question. part of program i'm building java opens chrome. wondering if after program opened chrome, there way search specific url or regular keywords (example: recipes, images, or google question.) you can code below.but work on windows string question="what this?"; question= question.replace(' ', '+'); try { runtime.getruntime().exec(new string[]{"cmd", "/c","start chrome https://www.google.com/search?q="+question}); } catch (exception e) { }

c - Why is my '+' operator considered as a new line character? -

the following code modular calculator problem. input data is: 5 +3 * 7 +10 * 2 * 3 +1 % 11 #include <stdio.h> int main(void) { char oper; int number,result; scanf("%d",&number); result=number; { oper=getchar(); fflush(stdin); scanf("%d",&number); if(oper=='+') { result=result+number; } else if(oper=='*') { result=result*number; } printf("%c %d %d ",oper,number,result); }while(oper!='%'); result=result%number; printf("%d",result); return 0; } the output follows: 3 5 3 5 * 7 35 10 35 10 35 * 2 70 2 70 * 3 210 1 210 1 210 % 11 210 1 i can't seem figure out why? replace oper=getchar(); fflush(stdin); scanf("%d",&number); with scanf(" %c", &oper); scanf("%d", &number);

html - JQgrid 'Grid can not be used in this (quirks) mode' IE 9 -

i have jsp creates jqgrid. when try open in ie9, iget error 'grid can not used in (quirks) mode' i have tried <meta http-equiv="x-ua-compatible" content="ie=edge" /> but not work. doctype <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> i have tried <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> but not work. with information given, agree ie should not going quirks mode. there few other things might triggering it; it's not possible information given, thing can think of white space before <!doctype> declaration. older ie versions have bug whereby if there white space in page before doctype - new line character - causes ie see doctype invalid. in turn kicks quirks mode.

javascript - jQuery second contextMenu don't show properly -

i made example http://jsfiddle.net/german_martin/oprkvys1/ of problem. i have big div (the blue one) contextmenu , inside div (green one) contextmenu. both contextmenu shows right click. if make right clic in blue div contextmenu shows fine. when clic in green div still appears old contextmenu. if refresh page , clic in green div, shows correct contextmenu. this html: <div class="cuadrofondo"> <div class="singleitem">item 1</div> <div class="singleitem">item 2</div> <div class="singleitem">item 3</div> </div> this js code: //centralizacion del dialog modal en la pantalla $(document).ready(function () { $.contextmenu({ selector: '.cuadrofondo', events: { //funcion para cambiarle el titulo la opcion seguridad en el menu flotante show: function () { var id = $(this).attr('id');

c++ - Named Shared Memory: shm_open not providing the correct location -

i having difficulty using shared memory. believe misunderstanding how shared memory supposed work. trying create template class project wrap posix shared memory api. when call mmap() second time, in same process, expecting see same ptr returned first time. not seeing. second address offset 0x1000 (i assume page boundary). when write first memory mapped location, data not show in second. i thought possibly data not getting syncd, tried calling msync(). did not help. i suspect of different addresses returned mmap(). seems might pointer-pointer, no of documentation or examples show pointer-pointers. so... obviously, leads me believe either doing wrong or misunderstand how named shared memory supposed work within same process. i have been pouring on man pages , on looking answers no avail. could please tell me doing wrong access same named shared memory location? or point me answer provides explanation require me on way again. please excuse debug cout , excessive document

ruby on rails - Ran Seed Data on Production Mysql Database Cleardb Heroku Data randomly generated fabricator faker -

i have simple rails app hosted on heroku using cleardb mysql add on. developing on mysql locally. having problem seeding data on production db on heroku. my seed data looks in db/seeds.rb. app using faker , fabrication gems. have user model , person model. fabricator(:user) first_name { faker::name.first_name } last_name { faker::name.last_name } birthday { faker::date.backward(14000) } phone_number { faker::phonenumber.phone_number } street { faker::address.street_address } city { faker::address.city } state { faker::address.state_abbr } zip_code { faker::address.zip } education { "bachelor" } image { file.open("app/assets/images/helloworld.jpg")} end fabricator(:person) full_name { faker::name.name } email { faker::internet.email } image { file.open("app/assets/images/puppy.jpg")} friend_test { 0 } user end #40.times { fabricate(:user)} #comment out because running below command generate user 40.times { fabrica

Javascript alert issue on form: Alert prompt keeps appearing -

can't provide link project due nda, hopefully, code i'll post more sufficient solve this. i'm doing simple php contact form. nothing crazy. 2 text input fields , checkbox validate age. if leave form unchecked, can't enter contest. i have validation working....to point. here's happening. when keep checkbox unchecked , try submit form, alert prompt saying i'm not 18 or over. js this: if (!document.forms[0].age.checked) { alert("sorry, must on 18 enter...please check on 18 box proceed"); } that works, , click "ok", alert prompt comes back! , i'm stuck in loop. anyone know how can form work? have tried if (!document.forms[0].age.checked) { alert("sorry, must on 18 enter...please check on 18 box proceed"); return false; }

angularjs - Directive / controller scope undefined when injecting directive in controller -

i have html <input type="file" file-input="files" multiple /> <button ng-click="upload()" type="button">upload</button> <li ng-repeat="file in files">{{file.name}}</li> this directive: .directive('fileinput', ['$parse', function($parse){ return { restrict: 'a', link: function(scope, elm, attrs){ //console.log("directives scope: ") elm.bind('change', function(){ $parse(attrs.fileinput) .assign(scope,elm[0].files) scope.$apply() //console.log(scope); }) } } }]); and in controller have function: $scope.upload=function(){ console.log($scope.files) var fd = new formdata() // put these 3 lines in service angular.foreach($scope.files, function(file){ fd.append('file', file) }) $http.post('/

javascript - Unable to get property 'contentWindow' of undefined or null reference -

i have ajax editor in bootstrap modal. first time modal opens runs fine, next time toolbar no longer there , throws error. ideas might happening? thanks unhandled exception @ line 84, column 9 in http://localhost:53818/scriptresource.axd?d=qnqjulwx76vy-vopv0soyewuqjsyitje2m_rwwfpn9dp9kl-kveuy2eip-ixad4lmlqvg3esyd48cwhyjvzaf9a1yrm5xmxfczwi0padvafnv8mz4aoolzvdvbmrkxacgpsjb28ti_zex-htr-9ysw2&t=ffffffffda74082d error thrown in scriptresource.axd - this._doc = this.get_element().contentwindow.document; _initiframe: function(value) { if (!sys.extended.ui.htmleditor.isie) { this._savedvalue = value; this._absandfixedparents = this._getabsandfixedparents(); } var str = sys.extended.ui.htmleditor.trim(this._preparecontent(value)); this._doc = this.get_element().contentwindow.document; if (!sys.extended.ui.htmleditor.isie) { this._doc.designmode = "on"; } this modal <div id="modaleventseditor" class=&q

AngularJS : directive template scope inheritance -

what correct way pass scope vars directive templates using ng-repeat? i'm trying iterate on array of data render "app" elements contain templateurls. if don't set scope : true in directive template vars empty. correct way pass vars defined in ng-repeat template without polluting scope? // controller userapp.controller('maincontroller', ['$scope', 'mainfactory', 'credsfactory', function($scope, mainfactory, credsfactory) { var findappsdata = function() { mainfactory.findappsdata() .success(function (data) { $scope.appsdata = data; }). error(function(error) { $scope.status = 'unable data: ' + error.message; }); }; findappsdata(); }]); // directive userapp.directive('app', function(){ return { restrict : "e", scope : {}, // vars referenced in template empty. scope : true //

javascript - Clone object's properties by reference -

my data object: var data = { foo: { bar: 42 }, baz: true, x: 1, y: 2 }; now i'd like send object json string. but before sending, i'd modify object and still keeping original one. var json = data; json.foo = json.foo.bar; json.id = json.baz; delete json.baz; of course modify data object, too. is possible create second object same structure first one, allows rename / delete properties without changing first object? i know this: var json = { foo: data.foo.bar, id: data.baz, x: data.x, y: data.y }; but imagine data object contains 50 properties , want change 2 of them. and don't want use jquery.copy or angular.copy because of performance reasons (they create real copies - shouldn't necessary). maybe there's ? var json = { foo: data.foo.bar, id: data.baz }; json = merge(json, data); delete json.baz; thank you! :) you can use angular.extend() or jquery.extend() copy original object's own propert

java - JLabel goes out of alignment (aka funky) when overlaying a rectangle on it -

i have gui making popular software imagemagick in java swing. now, implementing crop feature , trying implement drawable box denote region cropped. issue although have gotten rectangle draw on jlabel , jlabel starts move around once finish painting graphics on it. example, here screenshot of app before , after selection made. here code mousereleased() event listener private void input_showermousereleased(java.awt.event.mouseevent evt) { end_x = evt.getx(); end_y = evt.gety(); paint(input_shower.getgraphics()); input_shower.revalidate(); } here code paint() method public void paint(graphics g) { super.paintcomponents(g); graphics2d g2 = (graphics2d) g; g2.setcolor(color.red); g2.setstroke(new basicstroke(5)); rectangle2d.double rectangle = new rectangle2d.double(start_x, start_y, (end_x - start_x), (end_y - start_y)); g2.draw(rectangle); } are there ideas why happeni

ruby - Coerce to boolean -

given expression may return either truthy value or nil, truthy_or_nil = [true, 'truthy', nil].sample how can coerce result boolean without colleagues or linter complaining? !!truthy_or_nil # hard see !! on long line, unclear truthy_or_nil || false # linter complains "you can simplify this" !truthy_or_nil.nil? # unclear on long line truthy_or_nil ? true : false # hard see on long line, typing i have looked @ following questions , found them unrelated: why use !! coerce variable boolean use in conditional expression? - question more specific question because use of !! in conditional expressions. also, it's js. in environments take boolean arguments, idea wrap functions instead of allowing them implicitly coerced? - question more merit of technique technique itself. if question determined too broad , understand. if so, there better place ask it? the obvious solution create method in kernel à la array , integer , string etc.: mod

c# - store a reference to a script to attach at runtime -

Image
another best practice question. have list of scriptableobjects (thanks learningcocos2d) defines list of sprites can load @ runtime. i followed tutorial: http://www.jacobpennock.com/blog/?p=670 in order drive custom behaviour, want different scripts applied various in-game objects when instantiate them. what's best way store references desired scripts want apply? [edit] more details: my scriptable object simple list of serializable objects. have series of defined scripts want attach objects define. unity not seem allow me store reference script using below method. public class testlist : scriptableobject { public list<motionspritedata> motionsprites; } [system.serializable] public class motionspritedata { public component motionpath; } create class loads scripts array. class not have monobehaviour, example be. you have 2 options: drag , drop scripts array via editor . or put scripts in resources/scripts/ folder can loaded @ run time.

Python, yahoo yql quote error -

i have used yql console , have received appropriate response. however, sending python based query, continue have error. first console example: select * yahoo.finance.quotes symbol in ("yahoo", "aapl") i receive results block has expected fields. python example: import requests base_url = 'https://query.yahooapis.com/v1/public/yql?' query = 'q=select * yahoo.finance.quotes symbol in ("yhoo", "aapl")' full_query=base_url + query result = requests.get(full_query) print(result.content) with following response: b'\nno definition found table yahoo.finance.quotes' what missing? tia, clayton what missing env part of query: import json import urllib pprint import pprint base_url = 'https://query.yahooapis.com/v1/public/yql?' query = { 'q': 'select * yahoo.finance.quote symbol in ("yhoo","aapl")', 'format': 'json', 'env': '

python 2.7 - __init__.py in current working directory -

i have directory structure log_dedupe ├── dedupe │   ├── __init__.py │   ├── __init__.pyc │   ├── sha_dedupe.py │   ├── sha_dedupe.pyc │   └── test_sha_dedupe.pyc ├── globals.py ├── globals.pyc ├── __init__.py ├── __init__.pyc ├── log_dedupe_main.py ├── log_dedupe_main.pyc in log_dedupe_main.py from log_dedupe import parse_arguments results in importerror: no module named log_dedupe if added setup.py , install package don't error anymore. if change in init .py have reinstall. note considered importing __init__ in files wasn't sure if idea or not. having wasted hour of time find myself wondering if there's way either override current working directory use directory name rather '' automagically install python package if file has been changed. change directory log_dedupe/ in , invoke log_dedupe_main.py follows: python -m log_dedupe.log_dedupe_main` or better yet, rename log_dedupe_main.py __main__.py , invoke follows: pyt

c# - Linq join time error -

i'm trying create list using join on table. i've commented out code doesn't work, code need. when run cast date time error. i'm wondering if should trying join data or run subquery of result, can't figure out how do. if beingseen null want beingseen property in new object null. any suggestions on right way fill 'beingseen' property? object patientsnotseen; using (var db = new sydbconn()) { patientsnotseen = (from events in db.events events.clinicid == clinicid && events.statusid != 6 && dbfunctions.truncatetime(events.stime) == dbfunctions.truncatetime(datetime.now) //join beingseen in db.beingseenstatus on events.patientid equals beingseen.patientid caa //from beingseen in caa.defaultifempty() select new

c - Different logical addresses -

why when run like int i; printf("%p\n", &i); i different logical addresses each time run it, shouldn't same logical address mapped onto different physical address each time run it? memory allocated variable or program stack. memory allocated based on free space available in stack. when program executes first memory allocate executing function. next time execute same function , stack memory have other free memory. every time run program new stack address program.

iphone - My iOS app loses all animation effects when running app sometimes -

i have navigationcontroller based application, , stores many images in documents directory folder ( [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0] ). have used sqlite.db storing images locally. image storing process following: my web service returns array of images(url path) i convert url image data , store converted image data documents directory folder image path saved in sqlite db. my problem when insert multiple images documents folder, animation effects stops or loses. issue saving image url data( nsdata )is time taking process (my view freezes sometimes). how solve issue?please go through following code //my viewcontroller class nsstring * documentsdirectorypath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsmutablearray * mmsgarray = [[nsmutablearray alloc]init]; (int i=0; i<[imagearray count]; i++) { messages *msg = [[messages

Android : How to hide the Activity without using finish -

i'am calling activity broadcastreceiver. when phone ringing show activty. problem when use application if call means current activity not hiding. so cannot see calling screen , cannot pick call. whatever activity have opened, want hide when call coming , again want show same activity. before have used finish method in onreceive method. if use next time not calling broadcastreceiver. instead of code can write hide activities. @override public void onreceive(context context, intent intent) { loginactivity.context.finish(); mainativity.context.finish(); projectactivity.context.finish(); telephonyregister(context,intent); } try in activity. @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { movetasktoback(true); return true; } return super.onkeydown(keycode, event); }

c# - How do I trigger click event to get the coordinates from the map in uiversal app -

i trying perform seeimly simple task in universal app. want able click on map , have click trigger event give me coordinates. there many guides demonstrating how need solution work in universal app (windows 8.1/windowsphone). msdn-blogger ricky brundritt have written great posts on subject , have followed guide in order create map can used in both projects. http://blogs.msdn.com/b/rbrundritt/archive/2014/06/24/how-to-make-use-of-maps-in-universal-apps.aspx if understand correctly creates file conditional statements gets shared between projects. , when call method proper implementatoin gets used depending on project run: e.x: public void setview(basicgeoposition center, double zoom) { #if windows_app _map.setview(center.tolocation(), zoom); onpropertychanged("center"); onpropertychanged("zoom"); #elif windows_phone_app _map.c

ios - Listening for hardware keyboard key presses in Swift -

i'd add hardware keyboard support app users may trigger function called pressing key on keyboard @ time. found this article , able make work great in objective-c. i've converted swift, reason keypressed method not being called after press "c". confirmed keycommands called user presses key on keyboard. i'm testing ios simulator , mac's keyboard. what problem here in swift code? override func canbecomefirstresponder() -> bool { return true } func keycommands() -> [anyobject]? { var keycommands = [] struct static { static var oncetoken : dispatch_once_t = 0 } dispatch_once(&static.oncetoken) { let command = uikeycommand(input: "c", modifierflags: nil, action: "keypressed:") keycommands = [command] } return keycommands } func keypressed(command: uikeycommand) { println("user pressed c") //never gets called } the problem keycommands called every

java - How can I delete/edit row in JTable and MySQL using hibernate? -

Image
i have jtable displaying content of table in mysql database. able add record in jtable , database.. edit , delete operations possible in jtable (the changes not diplayed database). want add hibernate code in buttons events changes can displayed mysql database. any appreciated. here's class concerned: package com.hibernate.stock; import java.awt.borderlayout; import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.border.emptyborder; import javax.swing.table.defaulttablemodel; import java.awt.gridlayout; import javax.swing.jlabel; import javax.swing.jscrollpane; import javax.swing.jtextfield; import javax.swing.jtable; import javax.swing.jbutton; import org.hibernate.sqlquery; import org.hibernate.session; import org.hibernate.sessionfactory; import org.hibernate.transaction; import org.hibernate.cfg.configuration; import java.awt.event.actionlistener; import java.awt.event.actioneve