Posts

Showing posts from March, 2011

java - I can't understand what Maven is. I've red a lot about it but still don't get it -

it says maven build tool. ide? 'building'? mean it? assume want write java code. open eclipse, write class, export jar file , uses it. called building? if yes why need maven? it says manages dependencies. if i'm writing class needs dependencies, should know , import them shouldn't i? please understand maven ad can eclipse can't do? , please don't keep saying 'it's build tool' is ide? no not. (you may irritated listening yes build tool, why? check below) well 'building'? building bringing artifacts(classes,resources,xmls,jsons,etc) , introduce them each other. can work fulfill goals. also maven has structure, test classes goes in particular folder, test resource in particular folder, java source classes in particular folder, , on can check it. this has advantage, when deploy our project on jenkins knows find test classes, find test resources, find configuration files , many more locations. when talking hug

android - Meteor Cordova/Phonegap Local Assets -

i believe when building through meteor, assets in public folder should saved app? but upon looking through build folder, rootfolder/.meteor/cordova-build/platforms/android/assets/www/application/app/ not assets has been included in there. so question how make sure assets in there , secondly how access assets? because app still display assets when offline. thanks!

algorithm - Count number of cycles in directed graph using DFS -

i want count total number of directed cycles available in directed graph (only count required). you can assume graph given adjacency matrix. i know dfs not make working algorithm problem. please provide pseudo code using dfs . let consider , coloring nodes 3 types of color . if node yet discovered color white . if node discovered of descendants is/are yet discovered color grey. otherwise color black . now, while doing dfs if face situation when, there edge between 2 grey nodes graph has cycle. total number of cycles total number of times face situation mentioned above i.e. find edge between 2 grey nodes .

javascript - Dynamic alignment of div with array containing checkbox -

Image
first, apologize grammar i'm french (and said frenchy su** in grammar, i'm trying improve myself) so, i've table array automatically generated upload of excel list. table generated contain checkboxes. when click on checkboxes you've div appears. in div can wrote text reported in excel document , you've submit validation. summary guest check-list. the length of table variable , align div checkbox clicked. (you click , right there div appears). i've try fixed position not enought precise. can tell me how can or i've search ? <? header('content-type: text/html; charset=utf-8'); ?> <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta charset="utf-8" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.min.js"></script> <script src="https://cdnjs.cloudflare.c

cordova - phonegap to load a page as HTML while the file name is not *.htm? -

is possible let phonegap-built apps load page html while file name is, say, abc? why: on ios alert() , confirm() shows file name. not want show 'index.html'. if change single-page app's file name app's name (abc) alert() , confirm() appear showing app's name. what tried: when file name abc, html source displayed. in desktop web servers not setting mime type , web server serves page plain text. if app name alert title goal need install cordova dialogs plugin. https://github.com/apache/cordova-plugin-dialogs

python - Scrapy Spider cannot Extract contents of web page using xpath -

i have scrapy spider , using xpath selectors extract contents of page,kindly check going wrong from scrapy.contrib.loader import itemloader scrapy.contrib.spiders import crawlspider,rule scrapy.selector import htmlxpathselector medicalproject.items import medicalprojectitem scrapy.contrib.linkextractors.sgml import sgmllinkextractor scrapy.selector import htmlxpathselector scrapy import request class myspider(crawlspider): name = "medical" allowed_domains = ["yananow.org"] start_urls = ["http://yananow.org/query_stories.php"] rules = ( rule(sgmllinkextractor(allow=[r'display_story.php\?\id\=\d+']),callback='parse_page',follow=true), ) def parse_items(self, response): hxs = htmlxpathselector(response) titles = hxs.xpath('/html/body/div/table/tbody/tr[2]/td/table/tbody/tr/td') items = [] title in titles: item = medicalprojectitem() item["patient_name&qu

powershell - Restart-Computer does not have a -UseSSL parameter, gets stuck on "Waiting for WinRM" -

i using powershell v3.0. title suggests, cannot use restart-computer -computername *remotecomputer* -wait because command gets stuck trying connect winrm. i need ssl communicate hosts, use -usessl when calling invoke-command or enter-pssession. without that, command fails , i'm guessing it's same reasons winrm check fails. how restart remote computer , wait restart complete in scenario? use invoke-command run restart-computer command on remote computer. invoke-command -scriptblock {restart-computer} -computername test or invoke-command -scriptblock {shutdown -r -t 0} -computername test of course, you'll have add -usessl parameter not show because not know syntax it.

php - Laravel Global Storage -

i want store result of query in session (or global) variable, can retrieve variable different controller or action in laravel 5.1. i'll take time explain further, what's happening here getting data form, , after have more data different page , perform db transaction then. earlier used zend framework in had storage object in 1 store data in format. here code snippet. <?php namespace app\http\controllers; use illuminate\http\request; use illuminate\support\facades\session; use app\http\requests; use app\http\controllers\controller; use db; use auth; use illuminate\curl\curlrequesthandler; use config; class mycontroller extends controller { public function myajax(request $request) { $data = "some data db operation"; session::put('myformdata', $data2); $value = session::get('myformdata'); print_r($value); //works fine } public function someotherfunction(request $request){ $val = session::get('myformdata

ios - NSUserDefaults: Registering Defaults For Dictionary/Array values -

the setup suppose app has nsdictionary store in userdefaults key somedict . dictionary looks this: key1: value1 key2: value2 key3: value3 when app launches, use [nsuserdefaults registerdefaults:] set initial value of somedict key dictionary above. then, user changes preferences , dictionary gets updated looks this: key1: somenewvalue1 key2: value2 key3: value3 the key question i ship new version of app. new version has somedict 4 initial values instead of three: key1: value1 key2: value2 key3: value3 key4: somenewvalue the userdefaults domain contains value somedict , set when user ran older version of app. question this: -registerdefaults perform "deep" analysis of nsdictionary , nsarray values? in other words, -registerdefaults going detect key4 missing old dictionary stored in somedict , or going say, "there's value somedict , we're done"? i suspect latter. begs next question: there efficient approach handling sort of sit

python - How to use scrapy to crawl same url by post different data? -

i want crawl website post different page numbers,but data of first page spider finished,i think maybe crawl same url , filtered scrappy . here code: class zhejiangcrawl(spider): name = 'zhejiangcrawl' root_url= 'http://www.zjsfgkw.cn/execute/creditcompany' start_page = 1 current_page = start_page end_page = 24974 post_data = {'pageno': str(current_page), 'pagesize': '5', 'reallyname': '', 'credentialsnumber': '', 'ah': '', 'zxfy': '', 'startlarq': '','endlarq':''} headers = header cookies = cookies def start_requests(self): return [formrequest(self.root_url, headers=self.headers, cookies=self.cookies, formdata=self.post_data, dont_filter=true, callback=self.parse)] def parse(self, response): if self.current_page < self.end_page:

MongoDB aggregate include pseudo data -

i have simple aggregate returns sum of users status between time frame. user.aggregate([ { $match: { "created" : { $gt: startdate, $lt: enddate } } }, { $group: { "_id": "$status", "count" : { $sum: 1 } } } ]) what display data every day within date range, if there no data. so example, result may end this: [{ '_id' : '01-15-2015', status_counts: { 'active': 15, 'inactive': 25, 'removed': 2 } }, { '_id' : '01-16-2015', status_counts: { 'active': 0, 'inactive': 0, 'removed': 0 } }, { '_id' : '01-17-2015', status_counts: { 'active': 25, 'inactive': 5, 'removed': 1 } }] any ideas how go doing this? summing statuses , grouped day, if no data there, include default data zeroed out? exam

apache kafka - Best way to stream PDF Files -

what way stream pdf files through messaging queue? would idea in kafka? here have in mind: pick pdf files file drop location. stream files through kafka. parse files low level info retrieval , cleanup. done in storm topology or spark. maybe custom map reduce code. finally, wan run machine learning algorithms on these documents. note steps mentioned above possibilities. if have better implementation, please suggest. i'd break 3 problems: ingestion parsing analytics so can ingestion once iterate on parsing , analytics understanding of both data , problem evolve. for ingestion, i'd push actual file accessible location, such hdfs or http server , send short message via kafka file @ given location has been added , ready parsing. once file has been parsed, store info in database can iterate again on entire set of ingested files if parsing algorithm changes.

Get folder name of the file in Python -

in python command should use name of folder contains file i'm working with? "c:\folder1\folder2\filename.xml" here "folder2" want get. the thing i've come use os.path.split twice: foldername = os.path.split(os.path.split("c:\folder1\folder2\filename.xml")[0])[1] is there better way it? you can use dirname : os.path.dirname(path) return directory name of pathname path. first element of pair returned passing path function split(). and given full path, can split last portion of path. example, using basename : os.path.basename(path) return base name of pathname path. second element of pair returned passing path function split(). note result of function different unix basename program; basename '/foo/bar/' returns 'bar', basename() function returns empty string (''). all together: >>> import os >>> path=os.path.dirname("c:/folder1/folder2/filena

dependency injection - Spring How its helpful -

this question has answer here: what dependency injection? 30 answers i have class @component public class messageservicehelper { @autowired private messageservice messageservice; public boolean sendmessage(string text){ return messageservice.sendmessage(text); } public messageservice getmessageservice() { return messageservice; } public void setmessageservice(messageservice messageservice) { this.messageservice = messageservice; } } so here autowiring messageservice, whenever object ob messageservicehelper instantiated automatically inject dependency messageservice messageservicehelper. same thing can achieve if have write other class create instance of messageservice , call setter method. now here point can raised have shifted dependency resolution logic else , code coupled instantiation of messageservi

c# - Display File name in Label Text -

i'm using winforms . in form have picturebox . on form load application opens png picture specific folder inside computer. want able display file name in label. for example location is: c:\image\ the label should say: c:\image\mypicture.png private void form1_load(object sender, eventargs e) { try // tif file c:\image\ folder { string path = @"c:\image\"; string[] filename = directory.getfiles(path, "*.png"); picturebox1.load(filename[0]); lblfile.text = path; //i've tried this... not give file name } catch(exception ex) { messagebox.show("no files or " + ex.message); } } you have no need files ( directory.getfiles ), 1st one , let's get rid of array , simplify code: private void form1_load(object sender, eventargs e) { try // tif file c:\image\ folder { string path = @"c:

ios - store kit subscription sandbox time seems longer than documented -

i testing auto renewing subscriptions in storekit sandbox environment. it's seems working, except expiration times hours in stead of minutes. has else ran in problem. 1 month subscription lasting 12 hours not 5 minutes documented timeleft on purchase below: 11.8143773738874 [expires_date_ms: 1446002796000, purchase_date_pst: 2015-10-27 08:26:36 america/los_angeles, purchase_date_ms: 1445959596000, web_order_line_item_id: 1000000030764855, expires_date_pst: 2015-10-27 20:26:36 america/los_angeles, transaction_id: 1000000177540714, is_trial_period: false, product_id: xxxxxxxxxx.1_month_test_1, purchase_date: 2015-10-27 15:26:36 etc/gmt, expires_date: 2015-10-28 03:26:36 etc/gmt , original_purchase_date: 2015-10-27 15:26:36 etc/gmt , original_transaction_id: 1000000177540714, quantity: 1, original_purchase_date_ms: 1445959596000, original_purchase_date_pst: 2015-10-27 08:26:36 america/los_angeles] i experiencing same thing. me auto-renewing every day. , ke

python - Scrapy overwrite json files instead of appending the file -

is there way overwrite said file instead of appending it? example) scrapy crawl myspider -o "/path/to/json/my.json" -t json scrapy crawl myspider -o "/path/to/json/my.json" -t json will append my.json file instead of overwrite it. scrapy crawl myspider -t json --nolog -o - > "/path/to/json/my.json"

javascript - auto download the php script of the destination url -

i have script open child window every time click button. problem is, downloads php script. how prevent auto downloading of php script if child window open? in advance. here sample code open new window. <script> $('#btnshow').click(function(){ var mylog = document.getelementbyid('txtlog').value; window.open("/sample/sample.php?login="+mylog,"child","width=800,height=600"); } </script>

python - Plotting satellite swath data using pyresample -

i trying plot full swath orbit of ascat ocean wind vectors , wvc quality flags using pyresample module. link ascat netcdf files can found here: ftp://podaac-ftp.jpl.nasa.gov/alldata/ascat/preview/l2/metop_a/12km/ documentation have read on module, not describe on how can find information within file satisfy geometry area definition. example code here below on plotting swath of satellite data from netcdf4 import dataset import numpy np pyresample import image, geometry import pyresample pr i extract lons, lats, & wvc_quality_flag netcdf file area_id = 'ease_sh' name = 'antarctic ease grid' proj_id = 'ease_sh' proj4_args = 'proj=laea, lat_0=-90, lon_0=0, a=6371228.0, units=m' x_size = 425 y_size = 425 area_extent = (-5326849.0625,-5326849.0625,5326849.0625,5326849.0625) proj_dict = {'a': '6371228.0', 'units': 'm', 'lon_0': '0', 'proj': 'laea', 'lat_0': &#

Where can I find out the differences between themes/styles for android? -

i beginner developing apps , confused different styles/themes. have come contact following themes far: theme.appcompat.light.darkactionbar themeoverlay.appcompat.actionbar apptheme.noactionbar apptheme.appbaroverlay apptheme.popupoverlay where can find information on differences on styles, or when use them, or use them? as seem default styles/themes there should page summarizing styles/themes (and other ones), google search did not reveal useful! as stated in "applying styles , themes" http://developer.android.com/intl/es/guide/topics/ui/themes.html#platformstyles article: the android platform provides large collection of styles , themes can use in applications. can find reference of available styles in r.style class. http://developer.android.com/intl/es/reference/android/r.style.html

github - git pull Deleted My Files with Remote -

we 2 people working on same project. friend told me has done part , pushed github. part has finished today wanted push too. to accomplish, wanted pull first, merge files locally , push again. while trying update local repo commit, used git pull , resulted work gone, , instead of files, files appeared. i want recover files , correctly update repo files. it mentioning process: got local branch named "entrance" first, switched master, git merge entrance files being merged, showed on screen thought merge done. @ last, used git pull . if meet case, steps below: at first, make sure commit code before pulling friend's code. show reflog check history command: git reflog output should be: $ git reflog 90abbe3 head@{0}: pull origin master: fast-forward 3ab3527 head@{1}: commit: q defer 962e856 head@{2}: commit: getall terms tax 2d7f20d head@{3}: commit: bug list create reset previous commit command: git reset --hard head@{1} investigating reaso

iphone - Forcefully device orientation to Portrait not working in iOS 9 -

i using code snippet forcefully change device orientation. working fine before ios 9 not working ios 9. nsnumber *value = [nsnumber numberwithint:uiinterfaceorientationportrait]; [[uidevice currentdevice] setvalue:value forkey:@"orientation"]; is there alteration available in ios 9?

Prints new line after '\0' character in C -

i'm doing assignment recreate 3 switches of cat command, -n/-t/-e. compile , enter in 2 parameters, switch , file name. store textfile contents buffer. int main(int argc, char *argv[]){ int index = 0; int number = 1; int fd, n, e, t; n = e = t = 0; char command[5]; char buffer[buffersize]; strcpy(command, argv[1]); fd = open(argv[2], o_rdonly); if( fd == -1) { perror(argv[2]); exit(1); } read(fd, buffer,buffersize); if( !strcmp("cat", command)){ printf("%s\n", buffer); } else if( !strcmp("-n", command)){ n = 1; } else if( !strcmp("-e", command)){ e = 1; } else if( !strcmp("-t", command)){ t = 1; } else if( !strcmp("-ne", command) || !strcmp("-en", command)){ n = e = 1; } else if( !strcmp("-nt", command) || !strcmp("-tn", command)){ n = t = 1; } else if( !strcmp("-et", command) || !strcmp("-te", command)){ t = e = 1; } else if(

python - Selecting vlaues from a dataframe in pandas -

given dataframe of format a b c d ....... ........ i select rows value in column b greater 0.6*the last value in column.for eg, input: a b c 1 0 5 2 3 4 3 6 6 4 8 1 5 9 3 output: a b c 3 6 6 4 8 1 5 9 3 i doing following, x = df.loc[df.tail(1).index,'b'] which return series object corresponding index , value of coulmn b of last row of dataframe , then, new_df = df.[df.b > x] but getting error, valueerror: series lengths must match compare how should perform query? you need 1st take last value of column b using tail , multiply 0.6 . df[df['b'] > df['b'].tail(1).values[0] * 0.6]

Excel: Allocating Streams to Students based on GPA and Choice Preference -

i have total of 64 students allocated 19 different streams on basis of gpa. students have indicated preference streams. 5 students can allocated first 3 streams (a-c), 4 students stream d , remaining fifteen streams 3 students each. have added data excel sheet have no idea how process achieve above results. the data organized this . i'm happy share original file couldn't find way upload that. this solved automatically in vba macro faster version doing bit fast , dirty formulas. starts have already, ranking gpa. insert 2 rows each student. in row calculate "filling" of streams. if have bazillion students, should write small macro copy paste every other line. shame excel not accept pasting empty values no-change-values. either change rankings search/replace or create new sheet "desired allocation" value highest wanted stream. cell c2 should this: =20-'originalsheet'!c2 we working on new sheet so have these rows: (student - allo

Java : Load class based on user input -

i have class name user , load dynamically. public class sample{ public static void main(string[] args) { if(args.length < 1) { print_usage(); } else{ class inputclass = null; try { inputclass = class.forname(args[0]); } catch (classnotfoundexception e) { e.printstacktrace(); } } } i have classes named sample2, sample3: public class sample2 { private string name; } public class sample3 { private int value; } i want load class based on user input, either sample2/sample3 class. i have files in same directory, java.lang.classnotfoundexception error. how fix error? please more clear on question, assume typing in class names without package. if they're in package, must use class.forname that. class inputclass = null; try { inputclass = class.forname("my.package.myclass"); } catch (classnotfoundexception e) { e.printstacktrace(); }

php - How to parse recipes ingredient line using coldfusion? -

i using jsoup( http://jsoup.org/ ) parse html page , extract data page. in that, extracting recipes details cooking time, instructions & ingredients. take data html page , saved in archive table named recipeimport. before inserting these valid recipes table. have parse ingredients because has been stored in recipe_ingredient table based 3 different master tables namely recipeamount, recipeunittype & recipeingredient. let me consider simple ingredient "1 cup white sugar". i've separate amount(1), unittype(cup) , ingredient(sugar) match these(recipeamount, recipeunittype & recipeingredient) master table , insert ingredient in recipe_ingredient table reference id's. recipeamount table id amounttype amounttypevalue 1 1/2 0.5 2 1 1 recipeunittype table id unittype 1 cup 2 tbs 3 tsp 4 gram recipeingredient table id ingredientname 1 sugar 2 salt 3 honey finally, have save ingredient th

java - Open new window when double-click row -

i open new window; plan modify data in last column. status: cells editable; trigger: double-click on select line. i tried joptionpane whole table displayed. tablemodel model = new defaulttablemodel (donnee, titrecolonnes) { public class getcolumnclass(int columnnames) { class returnvalue; if ((columnnames >= 0) && (columnnames < getcolumncount())){ returnvalue = getvalueat(0, columnnames).getclass(); } else { returnvalue = object.class; } return returnvalue; } }; table = new jtable (model){ public boolean iscelleditable(int row, int colonne) { return false; } }; table.addmouselistener(new mouseadapter(){ public void mouseclicked(final mouseevent e) {

jquery - 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'SumoSelect' -

i'm getting above error message when trying call sumoselect function against select option element on aspx page. i have following references in web page: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js" type="text/javascript"></script> <script src="jquery.sumoselect.js" type="text/javascript"></script> <link href="sumoselect.css" rel="stylesheet" /> with files taken from: https://github.com/hemantnegi/jquery.sumoselect/zipball/master at present have included following in project download: jquery.sumoselect.js sumoselect.css my jquery correctly locating 1 of element with: <script type="text/javascript"> $(document).ready(function () { var elements = document.getelementsbytagname("*"); (i = 0; < elements.length; i++) { element = elements[i]; name = element.id; if (name.match(/fieldid_3/)) { $(ele

Save XML with attribute to Table in SQL Server -

Image
hi have xml data attribute input sql, need inserted in table. xml data is <?xml version="1.0" encoding="iso-8859-1"?> <messageack> <guid guid="kfafb30" submitdate="2015-10-15 11:30:29" id="1"> <error seq="1" code="28681" /> </guid> <guid guid="kfafb3" submitdate="2015-10-15 11:30:29" id="1"> <error seq="2" code="286381" /> </guid> </messageack> i want inserted in below format guid submit date id error seq code kfafb3 2015-10-15 11:30:29 1 1 28681 kfafb3 2015-10-15 11:30:29 1 1 2868 please help. look xpath , xml data type methods in msdn. 1 possible way : declare @xml xml = '...you xml string here...' insert yourtable select guid.value('@guid', 'varchar(100)') 'guid'

google app engine - Memcache not saving entity list on Java AppEngine -

i want save list of entity kind memcache. entity using objectify annotation. save list memcache do memcacheservice synccache = memcacheservicefactory.getmemcacheservice("food"); synccache.seterrorhandler(errorhandlers.getconsistentlogandcontinue(level.info)); synccache.put("foods",foodlist);//foodlist = arraylist of objectify entity synccache.put("timesaved",new datetime()); i keep getting error saying entity not serializable java.io.notserializableexception:'com.company.data.food' any ideas how might work? foodlist result of query. want save result of query memcache.

qr code - QR Encoder titanium module for Android -

i'm looking qr generator android. use titanium , need module this: qr encoder ios i don't want depend on thirds or in website, want generate own qr image work offline. thank advance. tried these 2 modules found on gittio? looks work both offline. http://gitt.io/component/com.acktie.mobile.ios.qr.encoder http://gitt.io/component/de.appwerft.qrcode

java - How to split a String at all special characters except dot? -

string line="word,1.2;3.1!4.5"; what regex should use in split(...) remove special characters except dot? (i need dot keep double , float values) (?!\\.)\\w you can use this.see demo. https://regex101.com/r/cd5jk1/4

How do I can specific multiple Google Maps Android API? -

Image
i've android project use google maps api. team project need numbers of api keys how many members are. however don't know how define in google_maps_api.xml total keys have. instead each member needs write key. so know if it's possible automate this: insert keys , when user run project check possible keys. from google maps api v2 can have unique api key multiple signing keys. useful in situations yours, or when need add release key. assuming using newest version of site, go api manager -> credentials -> api keys. there can add 1 line each developer: package key com.your.package key1 com.your.package key2 ...

php - Symfony Callback Validation with Yaml -

my validation not being called when defined using validation.yml. using php or annotation works fine. namespace appbundle\form; use symfony\component\validator\context\executioncontextinterface; class loginform { private $login; private $password; public function __construct($login, $password) { $this->login = $login; $this->password = $password; } public function validate(executioncontextinterface $context) { $context->buildviolation('error') ->atpath('login') ->addviolation(); } } this validation.yml appbundle\form\loginform: constraints: - callback: [validate] and controller class logincontroller extends controller { public function loginaction(request $request) { if ($request->ismethod('post')) { $login = $request->request->get('loginform_login'); $password = $request->request

python - music problems when using pygame + multiprocessing -

i'm tring run script play music via process. code below stripped down version of code it's enough replicate problem. if call normal() procedure hear music know procedure correct , connected properly, however, if call normal() using multiprocessing there no sound... runs normal() still no audio ... any suggestions? thanks! #!/usr/bin/python # # import required python libraries import pygame, time import multiprocessing mp localtime = time.asctime( time.localtime(time.time()) ) pygame.init() cs = 0 def normal( cs ): # main loop try: if cs == 1: while cs == 1: print " starting normal function" pygame.mixer.music.load('/home/user/scripts/music.mp3') pygame.mixer.music.play() time.sleep(20) pygame.mixer.music.stop() #return; except keyboardinterrupt: print "quit" try: print " s

yii - cannot echo data in a file located in extension/bootstraps/widgets -

i using yii 1.1 .i have class file inside widgets folder named mycommentstbeditablesaver. when try echo data in php file .it doesnot return thing. reason behind this? code:` public function insertrps() { //get params request $this->primarykey = yii::app()->request->getparam('pk'); $this->attribute = yii::app()->request->getparam('name'); //$this->attribute = yii::app()->request->getparam('comments'); $this->value = yii::app()->request->getparam('value'); //checking params if (empty($this->attribute)) { throw new cexception(yii::t('mycommentstbeditablesaver.editable', 'property "attribute" should defined.')); } if (empty($this->primarykey)) { throw new cexception(yii::t('mycommentstbeditablesaver.editable', 'property "primarykey" should defined.')); } $model=new projectcomments(); $comment

Complicated nested json loops to store with extjs -

Image
i'm using geojson extracted naturalearthdata looks : all want catch name of each feature in order display them in grid (live search grid.. btw efficient 2000 names?) can't access name root property. tried loop features ext.define('myapp.store.places', { extend: 'ext.data.store', alias: 'store.places', requires : ['myapp.model.placesmodel', 'myapp.view.main.mainmodel'], id: 'places', model: 'myapp.model.placesmodel', autoload: true, proxy: { type: 'ajax', url : '/resources/data/coord.json', reader: { type: 'json', transform: { fn: function(data) { for(var = 0; < data.features.length -1; i++){ names_places.push(data.features[i].properties.name); } debugger; return names_places;

javascript - Caching issue with webpack-dev-server -

i'm having issues when running webpack-dev-server. whenever save file, , changes compiled, not being reflected in browser. (no errors in command line) i'm running following command: webpack-dev-server --progress --color however, if run webpack every time have change, reflected in browser. i run chrome on mac (latest v. of osx), , i've enabled "disable cache while devtools open" option. needless say, hey - never know, have devtools open.. :) am missing simple step here? i had same problem , using dist/app.js file in html , not app.js generated webpack-dev-server. using in html solved issue: <script src="vendor.js"></script> <script src="app.js"></script>

GO Multiple Pointers -

i'm trying create function receives multiple types of struct , add pointer values function. example: type model1 struct { name string } type model2 struct { type bool } func myfunc(value ...interface{}) { otherfunc(value...) } func main() { myfunc( new(model), new(mode2) ); } the problem otherfunc allow &value, &value, etc parameter. have way pass values otherfunc(&value...) ? i'm not sure solve problem entirely however, exact thing requested feature in language. have use composite-literal syntax instantiation instead of new. pass pointers; myfunc( &model{}, &mode2{} ) thing is, you're still going dealing interface{} within myfunc i'm not sure able call otherfunc without unboxing (would type assertion if want technical).

How to find Oracle APEX Interactive report template -

i need make style changes oracle apex ir (apex version 4.2). purpose can find template of it. ? saved inside table or procedure ? interactive reports held in region , region can have template, has no effect on content, such ir. while can define report templates classic reports, not possible interactive reports . you cannot control structure (html) puts out. you can change style of applying css appropriate elements. don't have need alter source puts out. defining selectors , using browser tools inspect can influence , feel. word of warning though: heavily applying css bring trouble when upgrading apex 5, irs have been changed lot. means you'll have change selectors quite bit while doing more setup on ir. if you'd supply more info on kind of change you'd want make ir, answers more specific , concrete.

Cakephp 3 : How to receive get request data? -

i have written ajax send search key, have tried below code $.ajax({ method:'get', url:'<?php echo router::url(['action' => 'product_search']); ?>', data:{search:search}, success: function(data) { $('.fetch-data').html(data); } }); then have received in product controller if ($this->request->is(['get'])) { $search = $this->request->data('search'); } here $search null. if use post in here it's working fine. how can receive data method ? used below code in product controller if ($this->request->is(['get'])) { $search = $this->request->query('search'); } cookbook > controllers > request & response objects > query string parameters

html - Same column height with content inside -

today faced css problem. had issue 2 columns haven't same height because of contents , depending on screen resolution . set height of columns 650px . except , according resolution , button or content out of column (as height of latter fixed). see here picture ideas solve problem? ps : use bootstrap . <article class="section-wrapper clearfix" id="rejoindre"> <div class="content-wrapper clearfix"> <div class="col-sm-12 col-md-12"> <!-- titre --> <h1 class="text-center">vous aussi rejoignez l'aventure !</h1> <div class="col-sm-6 col-md-6"> <div class="thumbnail" style="height : 650px;"> <img alt="..." src= "assets/images/other_images/section_rejoindre/btn_decouverte.png">

Why specified content is not printed in log using batch script? -

i have print following content like: filesnames collecting user abcdef in ghijkl on date: 15-10-2015 time: 12:39:13 source folder: ( content missed here ) should printed in log file: filesnames collecting user abcdef in ghijkl on date: 15-10-2015 time: 12:39:13 source folder: d:\destination\folder\ and copied file names missing. this source: @echo off title filenames collector setlocal enabledelayedexpansion set hr=%time:~0,2% set hr=%hr: =0% set hr=%hr: =% /f "tokens=1,2 delims=#" %%a in ('"prompt #$h#$e# & echo on & %%b in (1) rem"') ( set "del=%%a" ) echo. set /p userinputpath=enter path: cd %userinputpath% dir /b > c:\users\%username%\filenames.txt start c:\users\%username%\filenames.txt exit :colorecho echo off <nul set /p ".=%del%" > "%~2" findstr /v /a:%1 /r "^$" "%~2" nul del "%~2" > nul 2>&1i echo. echo files names collecting

virtualhost - Tutum HAProxy Docker Virtual Host forward to entry point path -

i'm trying use haproxy tutum docker image load balance between 2 different web applications. both web applications has entry point of "/". @ section virtual host , virtual path see can use virtual hosts route different services. i've tried set virtual_host parameter web app 1 */webapp1* , web app 2 i've set /*webapp2* . when try navigate web app 1 through haproxy (using example http://haproxy-test.myname.svc.tutum.io/webapp1 ) forwards me http://<internal_ip_to_webapp1/webapp1 . haproxy forward calls /webapp1 http://<internal_ip_to_webapp1> (i.e. entry point of web app 1). how can achieve this? you should try adding host name in virtual_host parameter. like http://haproxy-test.myname.svc.tutum.io/webapp1/*

.net - How to get primary key columns out of a TSqlObject instance? -

i'm trying primary key columns out of tsqlobject instance in following manner: var constraint = table.getreferenced(modelschema.primarykeyconstraint, dacqueryscopes.all); of course doesn't work, getreferenced method expects instance of modelrelationshipclass instance. so how can done? code pk constraint given table bit this: private static tsqlobject getprimarykeyconstraint(tsqlobject table) { ienumerable<tsqlobject> constraints = table.getreferencing(primarykeyconstraint.host, dacqueryscopes.userdefined); return constraints.first(); }

javascript - How to include controller.js files in partials in angular? -

the 1 problem have angular.js apps can tell every single ".js" file service, controller, factory, etc. needs referenced or included in "index.html" file or causing end user have download js @ 1 time, can big if you've got lot of "modules". is there way in angular make such instead of referencing ".js" files in index.html, make each ".html" partial contains script tages referencing say: mydirectiveandcontroller.js never included in "index.html", included in mydirectiveandcontroller.html (assuming specific directive not available user unless user clicks on specific link). i want save bandwidth having user load in more need @ start, , linking every single directive , controller possibly used in application, or combining single fat minified js file not seem solve issue. i open alternatives solve problem.

linux - Terminal only shows $ -

i tried building own linux distribution , follow linux scratch book. when tried entering following commands in bashrc. set +h umask 022 lfs=/mnt/lfs lc_all=posix path=/tools/bin:/bin:/usr/bin export lfs lc_all path after when restart terminal. seeing $ symbol. thought entry made in bashrc problem. so, reverted , restarted system too. but, still seeing same problem. also, auto completion not working. please, me rid of this. welcome stackoverflow should set 'ps1' variable. search it ps1, example: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

android - How to apply aspect ratio from material design specs on a view? -

Image
i designing cardview app rich media header. i try make this: according google material design specification, picture should have 16:9 aspect ratio: so, question, how achieve (code or xml) ? if use defined size, not real 16:9 aspect ratio , have handle many resource files screen sizes , orientations. else, did not succeed set size code because in onbindviewholder(...) , getwidth() on view return 0. any idea ? the easiest way use percentrelativelayout parent viewgroup . can set follow xml attributes on imageview app:layout_widthpercent="100%" app:layout_aspectratio="178%" another option write own custom imageview , override onmeasure() ensure view ends 16:9 ratio. this answer shows how that.

ruby on rails - Devise failing to generate views with error "'require': cannot load such file -- devise/orm/false" -

i trying generate views devise upon adding devise existing app. rails g devise:install step completes successfully, when try rails g devise:views , error saying 'require': cannot load such file -- devise/orm/false after did lot of digging, realized problem first step appeared completing successfully, in reality, had atypical rails config/application.rb wasn't require 'rails/all' instead requiring modules needed (which didn't include active_record @ time). ended fixing along way, because wasn't included in application.rb when ran rails g devise:install , line require 'devise/orm/false' persisted in auto-generated config/initializers/devise.rb , , fail anytime trying load. i'm sure simple solution replace word "false" there "active_record", went ahead , deleted whole file , reran rails g devise:install command in case there else in there messed up. tl;dr make sure including rails/active_record before run

php - how to create a second a4 page in codeigniter? -

writing simple invoice web tool. invoices should in size of a4. controller: $this->load->view('static/print_header'); $this->load->view('static/print_invoice', $data); $this->load->view('static/print_footer'); $data invoice items positions like: header pos ---- item ---- price 1 item1 10€ 2 item2 10€ 3 itemitem 20€ footer if have many items (or have text) items go inside footer section , can't create right a4 page. how can change controller this: eg.: 2 pages if many items: page1: header pos ---- item ---- price 1 item1 10€ 2 item2 10€ 3 itemitem 20€ footer page2: header pos ---- item ---- price 4 item3 10€ 5 itemitemitem 40€ 6 itemitem1234 20€ footer edit: add invoice code <div id="content"> <div><span style="font-size: x-large;"><strong>invoice</strong></span></div> <hr /> <div>

How to speed up TCP initial connection time in standalone matlab program -

i have been trying make standalone matlab code uses tcp networking commands given matlab. when debug code in matlab enviornment connects right away, when run stand alone takes forever connect or not connect @ all. becomes unreliable during connection set up. once connection set data sent , received without issue. know why happening or have way fix this?

ios - Table Cells not loading on scroll -

i creating messaging page in app , having serious trouble. when page first loads looks fine when start scroll down gets messed up. new cells not load , when scroll cells gone except 1 shows , in wrong place. there async action going on. when message sent sends server , when returns reload data , scroll newly entered message @ bottom. buggy well. of time when sending message new cell not show up. after sending 1 or 2 more show up. here viewcontroller data source , delegate import uikit class messagedetailcontroller: uiviewcontroller,uitableviewdatasource,uitableviewdelegate, uitextfielddelegate { @iboutlet weak var lblmessagetext: uitextfield! @iboutlet weak var sendviewheightconstraint: nslayoutconstraint! @iboutlet weak var messagestable: uitableview! @iboutlet weak var sendmsgview: uiview! @iboutlet weak var sendmessageview: uiview! var messagedetailarray = [message]() override func viewdidload() { super.viewdidload() self.lblmessagetext.delegate =

orchardcms - Orchard 1.7 | NO Restore method in IContentManager -

while migrating orchard 1.9.1 project orchard 1.7, have used arana.versionmanager orchard gallery. we further customized our needs , had used restore method of orchard.contentmanagement.icontentmanager in 1.9.1 contentitem restore(contentitem contentitem, versionoptions options); however, when went orchard 1.7, there no restore method now. don't want lose restore functionality. please suggest next steps. code of restore method of content manager in 1.9.1 ? can including code in 1.7 work ?

javascript - own callback in jQuery, can't call secound callback function -

i have created plugin jquery , have found problem in plugin, when use times or more, callback function everytime use last callback function, ajax calls working shut , thats perfect. now got problems when want call success callback function or error callback function. (function ( $ ) { var setsettings = function(options,attrid) { var settings = $.extend({ datatype: 'json', timeout: 600, alerttoolbar: true, alertid : attrid, alertclass : 'dialogtoolbar', callback_error : null, callback_success : null }, options ); return settings; } var gettoolbar = function(header, content, mode) { if ( mode == 'error' ) { $( document.createelement('div') ) .addclass('alerttopnav alerttopnav-error') .append( $( document.createelement('div') ) .append( $( document.createelement('strong') )