Posts

Showing posts from August, 2012

sql - Rename a table used as reference in a another table -

sql - Rename a table used as reference in a another table - i have created 2 postgresql tables tables (the code originates django app): create table "app_book" ( "id" serial not null primary key, "title" varchar(256) ); create table "app_author" ( "book_ptr_id" integer not null primary key references "app_book" ("id") deferrable deferred, "name" varchar(128) not null ); i want rename table app_book app_item . next line sufficient, or have update references in app_author ? if so, how can that? alter table app_book rename app_item; looking @ this page, guess not. page not explain how update reference. see http://sqlfiddle.com/#!15/0dd1f/5 the problem described in link refers problems when using slony. if can live fact sequence "behind" id column not reflect name alter fine. if bothers you, need rename sequence well. note get_serial_sequence() still wo...

How to convert day/mon/year hour:min:sec to format to be inserted into mysql php -

How to convert day/mon/year hour:min:sec to format to be inserted into mysql php - i getting 5/10/2014 18:12:22 datetime in $_post['start'] , 19/10/2014 18:12:22 datetime in $_post['end'] . on using code if(isset($_post['start'])) if(!empty($_post['start'])) $start1=mysqli_real_escape_string($con,$_post['start']); if(isset($_post['end'])) if(!empty($_post['end'])) $end1=mysqli_real_escape_string($con,$_post['end']); echo $start = date('y-m-d h:i:s', strtotime($start1)); //returns 2014-05-10 18:12:22 echo '<br>'; echo $end = date('y-m-d h:i:s', strtotime($end1)); //returns 1970-01-01 00:00:00 die(); i don't no i'm doing wrongly please help help appreciated. if pertinent column datetime/timestamp in table, alternatively utilize datetime class reformat dates before insertion: simple example: $start1 = '5/10/2014 18:12:22'; // $_post['start']...

Storage manager function to implement read operations on a file -

Storage manager function to implement read operations on a file - how adapt programme perform next operations: 1.to read first block of file 2.to read current block of file 3.to read previous block of file 4.to read next block of file 5.to read lastly block of file next code written me read info file using file pointer , want implement above operations void main() { file *fptr; char filename[15]; char ch; printf("enter filename opened \n"); scanf("%s", filename); /* open file reading */ fptr = fopen(filename, "r"); if (fptr == null) { printf("cannot open file \n"); exit(0); } ch = fgetc(fptr); while (ch != eof) { printf ("%c", ch); ch = fgetc(fptr); } fclose(fptr); } any suggestions helpful. file storage fread filehandle fseek

java - Why is the sql connection getting created in new thread? -

java - Why is the sql connection getting created in new thread? - i have couple of question on class below. public class test { public void run() throws sqlexception { connection conn = getconnection(); dslcontext create = dsl.using(conn, sqldialect.mysql); // query books author named 'selena' result<record2<long, string>> result = create .select(book.id, book.title).from(book).join(book_author_rel) .on(book_author_rel.bookid.equal(book.id)).join(author) .on(book_author_rel.authorid.equal(author.id)) .where(author.name.equal("selena")) .orderby(book.title.asc(), book.id.asc()).fetch(); result.foreach((r) -> { system.out.println(string.format("%s (id: %s)", r.getvalue(book.title), r.getvalue(book.id))); }); conn.close(); system.exit(0); } public sta...

c# - I'm checking if my application is already running or not and it's saying running even if i stopped the application why? -

c# - I'm checking if my application is already running or not and it's saying running even if i stopped the application why? - inside program.cs did: using system; using system.collections.generic; using system.linq; using system.windows.forms; using system.diagnostics; using dannygeneral; namespace mws { static class programme { /// <summary> /// main entry point application. /// </summary> [stathread] static void main() { seek { if (isapplicationalreadyrunning() == true) { messagebox.show("the application running"); } else { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } } grab (exception err) ...

javascript - JSONP angular js displaying multiple objects -

javascript - JSONP angular js displaying multiple objects - similar question posted i'm having issue grabbing weather week , allocating different rows. format want is: mon tues wed thurs sydney 25 21 21 22 melbourne 26 18 21 24 etc unfortunatly grabbing first part of array , coppying areas. here js : app.controller('forecastctrl',function($scope, $http){ $scope.weatherdatasydney = null; $scope.weatherdatabrisbane = null; $scope.weatherdataperth = null; $scope.weatherdatamelbourne = null; $scope.weatherdataadelaide = null; $scope.weatherdatadarwin = null; $http.jsonp('http://api.wunderground.com/api/5ad0204df4bdbeff/forecast/q/australia/sydney.json?callback=json_callback').success(function(data){ $scope.weatherdatasydney=data; }); $http.jsonp('http://api.wunderground.com/api/5ad0204df4bdbeff/forecast/q/australia/...

java - Read from array and calculate average -

java - Read from array and calculate average - i trying write code reads row of characters array, assign characters integer , average integers of row, every row in array. here have far : scanner in = new scanner(new file("grades.txt")); while(in.hasnextline()) { int gp = 0; double gpa = 0; string line = in.nextline(); if(line.length() == 0) { continue; } line = line.substring(line.length()-15, line.length()); string[] letters = line.split(" "); (int = 0; < letters.length; i++) { if (letters[i].equals("h")) { gp += 7; } else if (letters[i].equals("d")) { gp += 6; } else if (letters[i].equals("c")) { gp += 5; } else if (letters[i].equals("p")) { gp += 4; } else if (letters[i].equals("f")) { gp += 0; } } gpa = gp / letters.length; system.out.println(gpa); } here array ...

mysql - Top 3 results from each player and sort by total -

mysql - Top 3 results from each player and sort by total - i need come results shows sum of top 3 results each player , sort sum example table: david = 12 mike = 17 john = 20 bill = 20 david = 12 mike = 16 john = 18 bill = 20 david = 11 mike = 15 john = 16 david = 10 mike = 14 john = 16 david = 10 john = 15 results needs show follows: john = 54 mike = 50 bill = 40 david = 35 i have in place rankings events (simple): select playername, sum(`eventpoints`) `eventresults` grouping `playername` order sum(`eventpoints`) desc i thinking next php code: create table called top3events truncate top3events @ startup read through results of query above on table eventresults use counter , reset each new playername insert top3events when counter <= 3 run query: select playername, sum(`eventpoints`) `top3events` grouping `playername` order sum(`eventpoints`) desc not sure if right way go this i guess no-one else wants t...

loading of functions in javascript -

loading of functions in javascript - i new javascript, started learning few days ago. learning functions , of tutorials reading said functions should set in script tag in head tag can loaded first. mean ? because wrote code <!doctype html> <html> <body> <p id="demo"></p> <script> function1(); function function1 () { document.getelementbyid("demo").innerhtml="hey"; } </script> </body> </html> and code works. thing don't understand how. how can phone call function hasn't been "loaded" yet? browser read script tag in different way rest of html document? can explain how work ? the script tag whole block. funtion1() called after whole script tag loaded. javascript

php - Laravel routing issues: automatically redirect to the root folder -

php - Laravel routing issues: automatically redirect to the root folder - i'm newbie in laravel world , have routing problems. i've new laravel installation project name lara located on local server localhost/lara i have follow route route::get('/lara', function() { homecoming 'test content'; }); but if seek open localhost/lara/public/lara i redirect automatically root folder localhost/lara could help me. give thanks you you can utilize next accomplish that. set @ bottom of route file or somewhere else wish. app::missing(function($exception) { if (request::is('*public/*')) homecoming redirect::to('/lara'); app::abort(404, 'page not found'); }); php laravel laravel-4 routing laravel-routing

android - type org.json.jsonobject cannot be converted to jsonarray -

android - type org.json.jsonobject cannot be converted to jsonarray - i have problem app , logcat shows tt type org.json.jsonobject cannot converted jsonarray. i'm not sure how solve problem. mean? how alter code here's logcat info: 10-15 06:33:05.394: e/json parser(1322): error parsing info org.json.jsonexception: value {"table2":[{"status":"queueing","phonenumber":"123","remarks":"w","peoplenumber":"5"},{"status":"","phonenumber":"345","remarks":"ss","peoplenumber":"3"},{"status":"","phonenumber":"555","remarks":"f","peoplenumber":"2"},{"status":"","phonenumber":"1345","remarks":"","peoplenumber":"5"}]} of type org.json.jsonobject cannot c...

c# - WCF .net streaming in chunks method calls slows down -

c# - WCF .net streaming in chunks method calls slows down - i have client-server wcf uploader/downloader. it downloads/uploads files in infinite loop (gets list of files , uploads/downloads them until stops it). the client created this: channelfactory<icontract> scf = new channelfactory<icontract>( this._endpoint.binding, this._endpoint.addressfull); this.channel = scf.createchannel(); this.channelfactory = scf; and binding tcp client/server , created this: public static custombinding getcustomtcpbinding(transfermode mode, long maxbufferbufferpoolsize, long maxreceivedmessagesize, int maxbuffersize, timeouthelper timeouts, streamertype st) { mtommessageencodingbindingelement binaryencoding = new mtommessageencodingbindingelement(); system.xml.xmldictionaryreaderquotas rq = binaryencoding.readerquotas; setreaderquotas(ref rq, int.maxvalue, int.maxvalue, int.maxvalue, int.maxvalue, int.maxvalue); tcptransportbindingelement tcptra...

imagebutton - how to join 4 images to one image button (android) -

imagebutton - how to join 4 images to one image button (android) - hello need bring together 4 separate images 1 imagebutton i want attach images should on 1 image button help. how can ? img1 on top img2 img3 @ middle img4 @ bottom like pyramid there nice article on merging 2 pictures. take look, , seek connect 4 of them http://android-er.blogspot.dk/2013/08/merge-two-image-overlap-with-alpha.html android imagebutton

javascript - vimeo - how do i add a custom control bar? -

javascript - vimeo - how do i add a custom control bar? - i've been searching on place code add together custom progress/control bar embedded vimeo videos. illustration of i'd progress bar @ bottom: http://www.5by.com/amazing-timelapses/posts/9lz/boston-layer-lapse any suggestions? thanks mike you need javascript, @ to the lowest degree how page works. <button onclick="player.toggleplaypause()" /> javascript actionscript

Lotus Notes: Losing data when export view data to a csv file -

Lotus Notes: Losing data when export view data to a csv file - i have view in lotus notes 8.5 want export info csv file. there these kind of fields list. have field called "editors".it has multiple editors 1 document. when export info csv file, field "frank, john, tom". comma separated. found sometimes, losing data. got "frank, john". "tom" lost. i have had same thing happen me.... losing data. found in of fields there commas included in field values , how info did not export. i ended writing agent lotusscript , exported info in manner. lotus-notes lotus-domino lotus

Creating highchart linechart with data using PHP (and Laravel) -

Creating highchart linechart with data using PHP (and Laravel) - i have dataset looks like: month_name | intake_total | adoption_totals jan | 12 | 36 feb | 4 | 12 march | 23 | 46 apr | 45 | 89 may | 10 | 15 june | 15 | 20 july | 23 | 22 august | 23 | 45 september | 45 | 67 oct | 23 | 12 nov | 45 | 100 dec | 0 | 12 and trying create array show line chart i have: $chartarray["chart"] = array("type" => "line"); $chartarray["title"] = array("text" => "intakes vs. adoptions"); $chartarray["credits"] = array("enabled" => false); $chartarray["xaxis"] = array("categories" => array()); foreach ($results $result) { $categoryarray[] = $result->month_name; $chartarray["series"][] = array("name" => 'intake totals', "data" => array($result->intake_total)); $chartarray["series"][] = array("name" =...

Expected speedup from embarrassingly parallel task using Python Multiprocessing -

Expected speedup from embarrassingly parallel task using Python Multiprocessing - i'm learning utilize python's multiprocessing bundle embarrassingly parallel problems, wrote serial , parallel versions determining number of primes less or equal natural number n. based on read blog post , stack overflow question, came next code: serial import math import time def is_prime(start, end): """determine how many primes within given range""" numprime = 0 n in range(start, end+1): isprime = true in range(2, math.floor(math.sqrt(n))+1): if n % == 0: isprime = false break if isprime: numprime += 1 if start == 1: numprime -= 1 # since 1 not prime homecoming numprime if __name__ == "__main__": natnum = 0 while natnum < 2: natnum = int(input('enter natural number greater 1: ')) starttime = time.time...

No viable overloaded operator[] for type 'vector<bitset>' c++ -

No viable overloaded operator[] for type 'vector<bitset<8>>' c++ - i maintain getting error: no viable overloaded operator[] type 'vector<bitset<8>>' i trying execute while hex value not contained within vector. guess error has way trying check element. if tell me how check vector defined constant great. here basic code: using namespace std; //variables trying compare #define halt_opcode 0x19; vector<bitset<8> > memory(65536); bitset<16> pc = 0; int main(int argc, const char * argv[]) { //error occurs here while(memory[pc] != halt_opcode){ fetchnextinstruction(); executeinstruction(); } homecoming 0; } i not see sense in construction while(memory[pc] != halt_opcode){ cout << "do something"; but in case have write while(memory[pc.to_ulong()].to_ulong() != halt_opcode){ cout << "do something"; or while(memory[pc...

mysql - Codeigniter - Can only load model in autoload.php -

mysql - Codeigniter - Can only load model in autoload.php - i'm going crazy because have been using codeigniter ages , cannot seem load model in view. this have done. model code (models/changelog.php): <?php class changelog extends ci_model { function __construct() { parent::__construct(); $this->load->database(); } function get_list() { $query = $this->db->get('changelog'); homecoming $query->result(); } } /* location: ./application/models/changelog.php */ this controller (controllers/explore.php): <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class explore extends ci_controller { public function index() { $this->load->view('include/header'); $this->load->view('home'); $this->load->view('include/footer'); } public function changelog() { $this->...

javascript - Keep form input on route change AngularJS -

javascript - Keep form input on route change AngularJS - consider example: main.html: <html> <body> <script> angular.module('app', ['ngroute']).config(function($routeprovider) { $routeprovider .when('/page1', { templateurl : 'page1.html' }) .when('/page2', { templateurl : 'page2.html' }) }) </script> <a href="#page1/">page 1</a> <a href="#page2/">page 2</a> <div ng-view></div> </body> </html> page1.html page 1: <input type="text"> page2.html page 2: <input type="text"> demo: http://plnkr.co/edit/1bfo7kkhemd3epsulngp?p=preview click on 1 of links page 1 or page 2. input in field , click on opposite link. field cleared. there way maintain input? useful if use...

java - When do someone need to check for a linked list cycle ? -

java - When do someone need to check for a linked list cycle ? - recently had interview java software developer , interviewer asked me some, according me, stupid questions. 1 of them if have e linked list how find if there cycle in linked list. question not how check cycle but, need real illustration when issue produced , when need check of list developing java web applications ?! linked lists among simplest , mutual info structures. can used implement several other mutual abstract info types, including lists (the abstract info type), stacks, queues, associative arrays, , s-expressions, though not uncommon implement other info structures straight without using list basis of implementation.{wikipedia} a malformed linked list loop causes infinite iteration on list fail because iteration never reach end of list. therefore, desirable able observe linked list malformed before trying iteration.so finding loop in linked list help avoid bugs , basic question computer...

linux - how to map ctrl + p to ctrl + space on vim sshd using mac terminal -

linux - how to map ctrl + p to ctrl + space on vim sshd using mac terminal - im using mac terminal ssh remote linux server. for autocompletion in vim, default key combo ctrl + p . how can alter ctrl + space ? most terminal emulators — , programs run in them — don't recognize <c-space> <c-space> @ all. vim gets null, noted <c-@> instead , acts if typed <c-@> insert mode command inserts lastly inserted text. so, basically, can't map <c-space> . what can do, though, map <c-@> : inoremap <c-@> <c-p> linux osx vim terminal

string split '\' in jquery or javascript -

string split '\' in jquery or javascript - i tried split string special character '\' not working. str = 'c:\images\jhjh.jpg'; result = str.split('\'); help me resolve issue. in advance your input string should escape \ , should escape \ in split function argument well. this should work str = 'c:\\images\\jhjh.jpg'; result = str.split('\\'); javascript jquery tokenize

How to protect chat messages from man in the middle (PHP, JavaScript) -

How to protect chat messages from man in the middle (PHP, JavaScript) - i'm working on chat scheme website. i'm no wondering how protect integrity of message. i'm doing via chat.class.php class chat{ private $config; private $randomjsonrpc; private $mysql; function __construct($config = 'chat.config.json') { $this->config = $config; unset($config); if(file_exists($this->config)) { $config = json_decode(file_get_contents($this->config), false); $config->configfile = $this->config; $this->config = $config; unset($config); } else { $this->error('configtest'); } require_once 'jsonrpc.class.php'; $jsonrpc = new jsonrpcclient('https://api.random.org/json-rpc/1/invoke'); $this->randomjsonrpc = $jsonrpc; unset($jsonrpc); $this->mysql = $this->databas...

java - hibernate projection unique list -

java - hibernate projection unique list - i'm trying utilize hibernate , projection result list doesn't have duplicated element. i have class currentityprofilebo, has property entityid. criteria criteria = session.createcriteria( currentityprofilebo.class, "entityprofilebo"); criteria.setprojection(projections.distinct(projections .projectionlist().add(projections.property("entityid")))); i'm getting exception: [2014-11-04 11:28:59] error [http-8080-5] (sqlexceptionhelper.java:144) - ora-01791: not selected look [2014-11-04 11:28:59] warn [http-8080-5] (abstracthandlerexceptionresolver.java:185) - handler execution resulted in exception org.hibernate.exception.sqlgrammarexception: ora-01791: not selected look @ org.hibernate.exception.internal.sqlexceptiontypedelegate.convert(sqlexceptiontypedelegate.java:82) appreciated helps! according sp00m. criteria.setresulttransformer(crit...

javascript - Issue with open tab group in titanium -

javascript - Issue with open tab group in titanium - i have 4 tabs in tab group. tab transition on click of tab names working fine. need open tab2 tab3 on click of button event in tab3. how can that. sample code, <alloy> <tab id="one"> <window class="container"> <label>this home view</label> </window> </tab> <tab id="two"> <window class="container"> <label>this sec view</label> </window> </tab> <tab id="three"> <window class="container"> <button onclick="savelang">proceed</button> </window> </tab> </alloy> controller: function savelang() { // how can open tab2 here // tried open index, loading time taking long , opening tab1 need open tab2 event } i not on scheme , still few issues/comments can mention : firstly uncertaint...

c++ - After reading a file, and (with append function) puting it into a file again, a lot of '\n' 's appear -

c++ - After reading a file, and (with append function) puting it into a file again, a lot of '\n' 's appear - basically, loadup text files, , set them text file, when outputing, when should this: nuskaityti krepsininku duomenys: komanda vardas pavarde gimimo m. ugis pozicija taskai klaidos kom1 var1 pav1 1985 189 gynejas 10 5 kom2 var2 pav2 1955 159 vidurys 7 2 kom3 var3 pav3 1999 162 gynejas 5 5 kom2 var4 pav4 1956 157 puolejas 5 3 kom1 var5 pav5 1986 185 gynejas 10 4 kom5 var6 pav6 1959 165 vidurys 21 3 kom3 var7 pav7 1992 192 puolejas 5 4 looks this nuskaityti krepsininku duomenys: (\n(not in code, showing purpose)) komanda vardas pavarde g...

html - Remove bubble count from multiple select menu -

html - Remove bubble count from multiple select menu - when using selection menu alternative multiple select, jquery mobile displays number alternative chosen - i.e. bubble count. <select name="locationlist" id="locationlist" multiple="multiple" data-close-btn="none" data-native-menu="false" data-corners="false" class="required"> <option>select location</option> <option value="rajajinagar">rajajinagar</option> <option value="vijayanagar">vijayanagar</option> <option value="hebbal">hebbal</option> <option value="baneswadi">baneswadi</option> <option value="mathikere">mathikere</option> <option value="yeshwanthpur">yeshwanthpur</option> </select> how remove bubble count select menu multiple select?...

android - How to store or save and retrieve multiple remote images locally -

android - How to store or save and retrieve multiple remote images locally - i looking solution in android store remote images (urls retrieved webservices) local (sdcard or sqlite db or cache) images can displayed in offline-mode too. because want display each time image during call. is there solution that? please follow these steps (for 1 image retrieval @ time): retrieve image bitmap url. convert bitmap byte array. store byte array blob field of sqlite db table. get blob sqlite db table. convert blob byte array. convert byte array bitmap. finally, set bitmap image onto imagemap of activity. public class imagestoreandretrievalactivity extends activity { private imageview imageview; private databasehandler dbhandler; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_image_store); imageview = (imageview)findviewbyid(r.id.imageview1); dbhandler = new databasehandler(ge...

html form - HtmlUnit: how to get password field when getInputByName/Value are not possible? -

html form - HtmlUnit: how to get password field when getInputByName/Value are not possible? - i writing little programme download blog articles, of protected username , password. that's htmlunit comes play. public articles, have no problem. protected articles, need log in using htmlunit. host page not provide name or value attributes in htmlform. next snippet of html code of host page. <form id="notlogin" tabindex="6" method="post" action="#" onsubmit="return false" style="outline: none;"> <div class="login-form-top"><input autocomplete="off" tabindex="7" id="loginname" type="text" name="loginname" value="" class="login-mod-input" placeholder="微博/博客/邮箱/手机号"><input id="loginpass" tabindex="8" type="password" name="" value="" class=...

ruby on rails - Creating a input that is dependent on another -

ruby on rails - Creating a input that is dependent on another - i want associate place activity, place has next fields: country city, adress , name. want like, take country , city, there appear (in dropdown) places have belong city, there anyway how can that? main problem variable :city_name, know cant create variables in views this, dont know how , how temporarily save it... help appreciated :) this code doesn't work, prototype want do: <%= form_for @activity, :html => { :class => "form-horizontal activity" } |f| %> <div class="transbox"> <h1><%= "add place activity" %></h1> </div> <div class = "box_round"> <div class="row"> <div class="control-group col-lg-10"> <%= f.label "city name", :class => 'control-label' %> <div c...

How to print the codes in python? -

How to print the codes in python? - this question has reply here: print out code in python script 1 reply how 1 print lines of code? suppose have here 2 variables. var1 = 2*8 msg = "answer is: " what statement should add together here programme print source code? the easiest way print lines of codes through utilize of built-in functions. print open(__file__).read() or write code in string mode , print them. won't executable codes anymore 1 time written in quotation marks. python

parsing - R: How do you input a new column into a table with the eval(parse()) as table name? -

parsing - R: How do you input a new column into a table with the eval(parse()) as table name? - i'm new r language may have missed out something... i'm trying run in loop. assuming i<-1, , parti1 table.(dataframe) partin<-paste("parti", i, sep = "") eval(parse(text = partin))["time"] <- "1" however, gives error of error in file(filename, "r") : cannot open connection in addition: warning message: in file(filename, "r") : cannot open file 'parti1': no such file or directory but gives no error when this eval(parse(text = partin))["time"] or this. parti1["time"]<-"1" or this. parti1<-eval(parse(text = paste("time", i, sep = ""))) i'm not sure if i'm doing wrong or if there's i'm missing. should not utilize eval(parse(mystring)) ? if so, should utilize instead? update: input: old ta...

Dynamically added edit text in found repeatedly after view is scroll down in list view in android -

Dynamically added edit text in found repeatedly after view is scroll down in list view in android - i using list view contain question textview , 2 button, yes , no. when click on no button layout shows, contain edittext. here code list view adapter: public view getview(int position, view convertview, viewgroup parent) { viewholder holder; if (convertview == null) { convertview = minflater.inflate(r.layout.questions_list_item, null); holder = new viewholder(); holder.question = (textview) convertview .findviewbyid(r.id.question); holder.questionno = (textview) convertview .findviewbyid(r.id.questionno); holder.yesbtn = (imagebutton) convertview .findviewbyid(r.id.yesbutton); holder.nobtn = (imagebutton) convertview .findviewbyid(r.id.nobutton); holder.subquestionlayout = (relativelayout) convertview .findviewbyid(r.id.subquestionlayout...

Convert php array to formatted string -

Convert php array to formatted string - lets have array this, multi-dimensional need create loop recursive. i think i'm close can't quite see i'm wrong. [ { "value": "rigging" }, { "value": "animation" }, { "value": "modeling" } ] function _replace_amp($post = array()) { foreach($post $key => $value) { if (is_array($value)) { $b = $this->_replace_amp($value); } else { $b .= $value . ', '; } } homecoming $b; } the intended result should be: "rigging, animation, modeling" i'm getting "modeling," in code, need write $b .= $this->_replace_amp($value); // note period without period, initiating $b every time script finds new array, want append results $b . other that, there nice implode function multidimensional arrays available: /** * recursively implodes ar...

For loop with Python for ArcGIS using Add Field and Field Calculator -

For loop with Python for ArcGIS using Add Field and Field Calculator - i'll seek give brief background here. received big amount of info digitized paper maps. each map saved individual file contains number of records (polygons mostly). goal merge of these files 1 shapefile or geodatabase, easy plenty task. however, other spatial information, records in file not have distinguishing info add together field , populate original file name track provenance. example, in file "505_dmg.shp" each record have "505_dmg" id in column in attribute table labeled "map_name". trying automate using python , sense close. here code i'm using: # import scheme module import arcpy arcpy import env arcpy.sa import * # set overwrite on/off arcpy.env.overwriteoutput = "true" # define workspace mywspace = "k:/research/data/ads_data/historic/r2_ads_historical_maps/digitized data/arapahoe/test" print mywspace # set workspace listf...

c# - Relationship Checks when Mocking EF Context -

c# - Relationship Checks when Mocking EF Context - i'm wondering if there way simulate foreign key checks when unit testing repository on top of ef using moq? have next code should technically fail because 1 of relationships isn't nowadays in either database or mocked sets on context. var entityset = new mock<dbset<myentity>>(); var mockcontext = new mock<mycontext>(); mockcontext.setup(x => x.set<myentity>()).returns(entityset.object); var myentity = new myentity { refid = "abcd", //foreign key not exist in context }; var repo = new myrepo<myentity>(mockcontext.object); repo.add(myentity); //repo.add() public void add(tentity entity) { dbset.add(entity); context.savechanges(); } i expect code fail since object reference id doesn't exist succeeds , verifies add together mockcontext succeed. i'm not sure purpose unit testing pattern serves. since you're mocking dbset , ne...

java - Use of @JoinColumnsOrFormulas and mappedBy -

java - Use of @JoinColumnsOrFormulas and mappedBy - i have issue next code : table fibean : @joincolumnsorformulas({ @joincolumnorformula(column = @joincolumn(name = "tri", referencedcolumnname = "tri", nullable = false, insertable = false, updatable = false)), @joincolumnorformula(formula = @joinformula(value = "user1", referencedcolumnname = "code")) }) private userbean user1; table userbean : @onetomany(mappedby="user1", cascade={cascadetype.persist, cascadetype.merge}) private collection<fibean> listeuser1; then, error happen : caused by: java.lang.classcastexception: org.hibernate.mapping.formula @ org.hibernate.cfg.annotations.tablebinder.bindfk(tablebinder.java:352) @ org.hibernate.cfg.annotations.collectionbinder.bindcollectionsecondpass(collectionbinder.java:1423) @ org.hibernate.cfg.annotations.collectionbinder.bindonetomanysecondpass(collectionbinder.java:733) @ org.hibernate.cfg.annotati...

Android AlertDialog produces black text with black background -

Android AlertDialog produces black text with black background - i having issue custom view in dialog on android api 10. i utilize alertdialog.builder build dialog. include custom view panel using setview command on builder. this works on of api's i've tested with. style changes device device, want, style match device default. my problem on api 10, text in custom view shows black on black background. any text insert using alertdialog.builder.setmessage() appears correctly. what magical attribute/style dialog builder using determine text appearance? my app's theme theme.appcompat.light . here oncreatedialog method: public dialog oncreatedialog(bundle savedinstancestate) { layoutinflater inflater = getactivity().getlayoutinflater(); final view view = inflater.inflate(r.layout.fragment_status_dialog, null); mstatustextview = (textview) view.findviewbyid(r.id.text_status); mconnecteddevicetextview = (textview) view.findviewbyid(r.id...