Posts

Showing posts from August, 2014

python - Django Error: TypeError: expected string or buffer -

i'm writing code django-based static blog, coming across similar issue across 3 or 4 different areas of code. figured if can 1 fixed can others fixed well. code of focus django-command call update_blog1 . here's traceback... traceback (most recent call last): file "c:\python34\lib\site-packages\django\core\handlers\base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) file "c:/users/jaysp_000/firstsite/projectone\blog_static\views.py", line 179, in archive {'posts' : posts} file "c:/users/jaysp_000/firstsite/projectone\blog_static\views.py", line 14, in render_response return render_to_response(*args, **kwargs) file "c:\python34\lib\site-packages\django\shortcuts.py", line 45, in render_to_response using=using) file "c:\python34\lib\site-packages\django\template\loader.py", line 116, in render_to_string template_name, context, context_instance, dirs, d...

android - Dynamicially set an imageView over another imageView -

i code game battleship. when player has put ship on playfield dropping imageview (a ship) able mark ship being hit putting imageview indicating later on. this layout far (setup configure ships): <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:weightsum="1" android:background="@drawable/background_blue" android:layout_gravity="top|center_horizontal" > <imageview android:id="@+id/imagesetzeschiffe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top" android:src="@drawable/im...

VHDL MUX Test Bench Issue -

Image
i'm trying learn vhdl through p. ashenden's book: designer's guide vhdl. chapter one's exercise 10 asks write 2-to-1 (i'm assuming 1 bit wide) mux in vhdl , simulate it. apologize in advance being complete noob. first vhdl code. my mux didn't produce errors or warnings in synthesis. test bench doesn't produce errors or warnings, either. however, simulation comes blank, except names of signals. i've tried looking @ multitude of other mux examples online (as bench test example book), of gave errors when tried sythesizing them, wasn't confident enough use them guides , didn't out of them. i'm not sure i'm doing wrong here. i'd include image of simulation, don't have enough rep points :( also, realize mux should have cases when receives no select input/high impedance values, ect.. in case, i'm trying toy model working. the mux code is: library ieee; use ieee.std_logic_1164.all; entity muxtop port (a, b, sel: in ...

AngularJS ng-repeat duplicated error, when search is fired -

i have listing using ng-repeat search 2 available parameters (month , state). if make search, ng-repeat error found duplicates. can not understand why if in both cases json data have same structure (just values change). i have these ng-repeats: item in data , nested inside : uniqueitem in item i've tried use track $index loops every single character, , item.index or item.label1 triggers found duplicates erros again. here loop using ng-repeat. <tbody ng-repeat="item in data"> <tr ng-repeat="uniqueitem in item"> <td> {{uniqueitem.label1 | number}} </td> <td> {{uniqueitem.label2 | number}} </td> my json has structure : [ { "index": 0, "label1": "initials", "label2": "2", "label3": "18", "label4": "12", "label5": 150, ...

asp.net mvc - Bootstrap tabs in layout.cshtml - not rendering body -

i have started learning mvc bootstrap. have setup layout page following: <ul class="nav nav-tabs"> <li class="active">@html.actionlink("home", "index", "home", null, new { @data_toggle = "tab", href = "#home" })</li> <li>@html.actionlink("programming", "programming", "home", null, new { @data_toggle = "tab", href = "#programming" })</li> </ul> <div class="tab-content"> @renderbody() </div> my homecontroller: public actionresult index() { viewbag.message = "modify template jump-start asp.net mvc application."; return view(); } public actionresult programming() { viewbag.message = "your programming tab page"; return view(); } my views: index.cshtml @{ viewbag.title = "home page...

treemap - How tree map uses red black tree algorithm -

i have read many articles on red black tree take o(log n) time operations .i not clear how works , how tree map uses red black tree algorithm balance tree compared binary search tree. ref links https://www.topcoder.com/community/data-science/data-science-tutorials/an-introduction-to-binary-search-and-red-black-trees/ can please explain example how algorithm works. a red-black tree is binary search tree. it's flavor of bst has fancy versions of insert , delete operations reorganize tree run tree never gets "long , stringy." longer , stringier tree gets, more behaves linked list. on average, linked list operations require half list touched (or whole list in worst case), run time varies linearly (o(n) in number of elements n). when tree "bushy" or balanced, operations cheaper ( o (log n) ) each. red-black algorithms guarantee tree remains bushy. to make concrete, here 2 trees store keys g. left long , stringy. note how looks list. in worst ...

Can there be anything between keyword 'class' and class name in c++? -

i encountered code in c++ class has been defined : class macro class_name { public : private : } if saw on windows code, macro determine if want export or import given class. it's common if dealing dll-s. so, macro this: #ifdef projectname_exports #define macrobeforeclassname __declspec(dllexport) #else #define macrobeforeclassname __declspec(dllimport) #endif if compile dll, projectname_exports preprocessor definition should defined, compiler export given class. if compile project using given dll, ...exports won't defined, compiler import given class.

visual studio - VS emulator for Android stops responding to keyboard -

i've been using new vs emulator android few days now, , while works brilliantly otherwise, randomly stops receiving keyboard events. change keyboard language when press ctrl + space, won't receive characters when try type text. so far, solution i've found swap between virtual keyboard , physical keyboard multiple times before physical keyboard starts working again. is bug in emulator, or doing causes physical keyboard not function correctly? didn't see settings in emulator input. the bug occurs when hit win + r. thesis is, switch focus in emulator. to work again, mouse click editbox or gives app focus again , hit win . windows opens start menu. click in emulator, , can type again. i submitted bug ms. another possibility emulator thinks alt key pressed, hit alt release it.

c - Bitwise operation with (signed) enum value -

i using enumerator values flags: typedef enum { = 0x00, b = 0x01u, // u has no influence, expected c = 0x02u, // u has no influence, expected ... } enum_name; volatile unsigned char* reg = someaddress; *reg |= b; according misra-c:2004 bitwise operations shall not done signed type. unfortunately, compiler iar use signed int (or short or char) underlying type of enums, , option can find relates size, not signedness ("--enum-is-int"). according iar c/c++ development guide arm , pages 169 , 211, can define type of enum s if enable iar language extensions ( -e command-line option, or project > options > c/c++ compiler > language > allow iar extensions in ide). in particular, should define "sentinel" value, make sure compiler chooses correct type. prefers signed types, , uses smallest possible integer type, sentinel should largest positive integer corresponding unsigned integer type can describe. example, typedef enum ...

css - @media query not working in mobile. Works fine in Chrome -

Image
i trying working somehow not working in mobile. when use chrome tool overrides screen size, works fine. not sure doing wrong. please help @media screen , (min-device-width : 320px) , (max-device-width : 480px) { .container .backgroundimage { display: none; } } there background image when viewed in browser. s remove image when viewed in mobile not working somehow.. please help ============= testing on iphone 3g, 4, 5, android galaxy nexus @andy right, double check device-widths , or use min-width don't have know every device width. regardless make sure have viewport tag, <meta name="viewport" content="width=device-width,initial-scale=1.0"> .

sql server - SQL IF to Set Parameter Value Within SELECT Statement -

edit: problem has been solved using better method. rather using variable concatenating results desired output. i trying values several fields couple of different tables , works fine. have "@description" concatenation of hard coded text based on existing values each row. declare @description varchar(1000) = '' select t1.id t1.mytype t1.myname ,case when ( t1.avalue1 = 1 , t1.avalue2 = 1 , t2.avalue1 = 1 , t2.avalue2 = 1 ) 'eligible' else 'not eligible' end 'iseligible' ,@description -- i'm trying set description /* if ( t1.avalue1 = 2 ) set @description = @description + ' t1.avalue1 2' if ( t1.avalue2 = 2 ) set @description = @description + ' t1.avalue2 2' if ( t2.avalue1 = 2 ...

Lightswitch html client override default save button -

i want able override default save button on html client cant seem find control so. want write validation behind , allow user select option cant seem find it. i know silverlight client can override cant seem override in html client. thanks it's achieved using beforeapplychanges. example: (please excuse typos/syntax errors, rough idea!) myapp.addeditscreen.beforeapplychanges = function (screen) { switch (screen.property_savingstatus) { case 'not saving': settimeout(function () { // override save -> toggle savingstatus -> call save again savemychangesmyway(); screen.property_savingstatus = 'commit'; myapp.commitchanges(); // or discard or apply. }, 500); return false; // cancel save changes request break; case 'apply': return true; break; default: };

ios - UILongPressGestureRecognizer crashes in tableview when dragged to top of view - SWIFT -

i using uilongpressgesturerecognizer each cell in table view has 2 sections/section headers. when long press on cell in first section , drag top of table view app crashes. (i have disabled longpressgesturerecognizer second section). exception point @ line below, var indexpath: nsindexpath? = self.routetableview.indexpathforrowatpoint(location)! i receive error in debugger, fatal error: unexpectedly found nil while unwrapping optional value my code below, func longpressgesturerecognized(gesture: uilongpressgesturerecognizer){ var state: uigesturerecognizerstate = gesture.state var location:cgpoint = gesture.locationinview(self.routetableview) var indexpath: nsindexpath? = self.routetableview.indexpathforrowatpoint(location)! if indexpath == nil { return } if indexpath?.section != 1 { switch(state){ case uigesturerecognizerstate.began: sourceindexpath = indexpath var cell: uitable...

java - How to send HTTP request from android app to Heroku -

i have android app uses twilio sdk , hosted heroku server. i'm trying push button in app send http request heroku send rest api request twilio update twiml url. current way i'm trying send the http request not working. have looked through of examples find , none of them show how function. know how this? in advance. this code trying send http request heroku holdbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://yourappnamehere.herokuapp.com/hello"); try { // execute http post request httpresponse response = httpclient.execute(httppost); httpentity ht = response.getentity(); bufferedhttpentity buf = new bufferedhttpentity(ht); inputstream = buf.getcontent(); bufferedrea...

jsf - Customize converter message to include input with bolded invalid characters -

mojarra 2.1.29 consider standard javax.faces.integer converter. if enter invalid number we'll recieve message: 'foo' must number consisting of 1 or more digits i need customize message follows if number contains invalid charaters, print input along bolded invalid charaters. instance 1234add the number contains invalid charaters: 1234 add i think it's not possible define own custom properties file containing message follows: javax.faces.converter.bigintegerconverter.biginteger={2}: ''{0}'' must number consisting of 1 or more digits. do have write own custom converter subclass of javax.faces.integer ? is possible customize error-message in such way without writing custom converter? yes, it's possible. it's hacky 2 reasons: formatting logic been encapsulated in el instead of in reusable java class (although create special tagfile prevent copypasting on place in case intend reuse same logic elsewhere). html n...

user interface - Codename one image issue -

i'm creating app using codename 1 when add images button quality compromised. icons high quality png files not issue. know how can add images , maintain quality? i'm guessing set image background instead of setting them icon defaults scaling. try scale fill background behavior setting or writing more descriptive question. suggest using multi-images http://www.codenameone.com/how-do-i---fetch-an-image-from-the-resource-file---add-a-multiimage

group concat - Issue with Mysql SUM and GROUP_CONCAT in query -

i having issue query having both sum , group_concat function. the sum values changes group_concat values increases. below code: select ul.display_name, ul.photo, ul.user_id, sum(ulr.level_score) level_scores, sum(ulr.level_timer) level_timer, group_concat(ulr.level_completed) levels, group_concat(distinct c.bit_id) bit_id user_level_responses ulr inner join user_login ul on ( ul.user_id=ulr.user_id) inner join c_member cm on ( cm.user_id=ul.user_id , cm.user_approval='y' , cm.delete_status='0' , cm.status='1') inner join ctree ct on ( cm.circuit_id=ct.circuit_id ) inner join cir c on ( c.circuits_id=cm.circuit_id ...

unity3d - Put Video Above the Image Target in Android AR -

i use unity create augmented reality app via vuforia, want replace 3d object above image target playing video playback. how can that? login vuforia developer portal , select downloads -> samples , scroll down advanced topics. download unity package listed in section, has sample scene of how video playback on image target. https://developer.vuforia.com/downloads/samples

xslt - Unnest parent nodes by child node -

in xml there items 0-n attributes , item should copied each attribute new item 1 attribute. given xml this: <?xml version="1.0" encoding="utf-8" ?> <items> <item> <name>a</name> <attributes> <attribute> <key>attribute1</key> <value>1</value> </attribute> </attributes> </item> <item> <name>b</name> </item> <item> <name>c</name> <attributes> <attribute> <key>attribute1</key> <value>5</value> </attribute> <attribute> <key>attribute2</key> <value>2</value> </attribute> <attribute> <key>attri...

robots.txt - Google Mobile-Friendly Test - strange statement -

when testing first training website project in google mobile-friendly test strange statement claiming requested url marked not allowed. (i not quoting not in english language.) it strange there no robots.txt file in project. i'll grateful help. ps: here link google tool: https://www.google.com/webmasters/tools/mobile-friendly/

java - How to replace all non-digit charaters in a string? -

i need replace non-digit charaters in string. instance: string: 987sdf09870987=-0\\\`42 replaced: 987**sdf**09870987**=-**0**\\\`**42 that's non-digit char-sequence wrapped ** charaters. how can string::replaceall() ? (?![0-9]+$).* the regex doesn't match want. how can that? (\\d+) you can use , replace **$1** .see demo. https://regex101.com/r/fm9ly3/2

ubuntu - I often can't type anything suddenly in IntellijIDEA -

os:ubuntu 15.04 jdk:1.8 idea version:idea-iu-141.1532.4 i haven't still found regular anyway. burst in on me, , can't type in edit area, can select code yet. , restart , normal...and ... maybe after few minutes come again.

spring - Java generic utility method to convert between two types -

i have method convert between objects of 2 different classes. these dto objects , hibernate entity classes. public static domainobject1 converttodomain(persistedobject1 pobj) { if (pobj == null) return null; domainobject1 dobj = new domainobject1(); beanutils.copyproperties(pobj,dobj); //copy property values of given source bean target bean. return dobj; } instead of having same method domainobject2 , persistedobject2 , on .. is possible have generic method below signature? (without having pass source , target class) public static<u,v> u converttodomain(v pobj) { ...} ps: (a different topic wasteful use dto when entities have same structure people don't agree despite hibernate documentation , other sources) to achieve need pass class of domain object looking for. following work: public static <t> t convert(object source, class<t> targettype) throws instantiationexception, ...

c# - Razor syntax broken on MVC 5 views VS2013 -

i have following problem: razor syntax shows errors on view , won't autocomplete in cases, example: @model somemodel // name 'model' not exist in current context @html.editorfor(m=>m.someprop) // system.web.webpages.html.htmlhelper not contain defenition 'editorfor'.... same .partial , .otherextensions //this work: @html.checkbox //.dropdown .encode .hidden ect... (the non extended properties of html) what i've tried far based on similar topics: make sure have same webpages / mvc version on web.config in main dir. , in views dir. unload project, delete .user file, reload project (that helped once though) rebuild/ clean/ delete bin files this driving me crazy, please help! added: using webpages 3.0.3xxx , mvc 5.2.3xxx added #2: seems happen because views directory separated project - don't it! use views in same project mvc controllers. the mvc architecture looks views in following folders ~/views/controllername/actionna...

ubuntu - Running Docker Commands with a bash script inside a container -

i'm trying automate deployment webhooks docker hub based on this tutorial . 1 container runs web app on port 80. on same host run container listens post requests docker hub, triggering host update webapp image. post request triggers bash script looks this: echo pulling... docker pull my_username/image docker stop img docker rm img docker run --name img -d -p 80:80 my_username/image a test payload succesfully triggers script. however, container logs following complaints: pulling... app/deploy.sh: line 4: docker: command not found ... app/deploy.sh: line 7: docker: command not found it seems bash script not access host implicitly. how proceed? stuff tried did not work: when firing listener container added host ip based on docs : hostip=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print\$2}' | cut -d / -f 1` docker run --name listener --add-host=docker:${hostip} -e token="test654321" -d -p 5000:5000 mjhea0/docker-hook-listener similarl...

WEKA cross validation discretization -

i'm trying improve accuracy of weka model applying unsupervised discretize filter. need decided on number of bins , whether equal frequency binning should used. normally, optimize using training set. however, how determine bin size , whether equal frequency binning should used when using cross-validation? initial idea use accuracy result of classifier in multiple cross-validation tests find optimal bin size. however, isn't wrong, despite using cross-validation, use same set test accuracy of model, because have overfitted model? correct way of determining bin sizes? i tried supervized discretize filter determine bin sizes, results in in single bins. mean data random , therefore cannot clustered multiple bins? yes, correct in both idea , concerns first issue. what trying parameter optimization . term used when try optimize parameters of classifier, e.g., number of trees random forest or c parameter svms. can apply pre-processing steps , filters. what have in ...

jQuery.ajax error: Unexpected token ":" -

i trying function make web request , retrieve json data, keep getting same error: "uncaught syntaxerror: unexpected token :" this have setup right now: jquery.noconflict(); (function($) { $(document).ready(function(){ $.ajax({ url: 'http://[website url]/json/', context: this, datatype: "jsonp", contenttype: "application/json" }).done(function(response){ alert("here");//this meant testing purposes--the code never seems far }); }); }(jquery)); i feel i'm close getting things setup correctly apparently i'm still missing something. tried using json instead of jsonp did not work since i'm calling different domain i'm on. json data setup correctly can tell: {"name":"[value]","estimated time":"[time estimate]"} am missing inside $.ajax? or there wrong setup of json data?

Adding Bootstrap attributes to Rails Simple Form input -

the following form snippet boolean styled checkbox: = form.input :recur, label: "recurring" i need 2 things: 1) style bootstrap button rather checkbox 2) add data-target , data-toggle attributes this html code need add form button styling , collapse functionality , i'm having hard time figuring out right syntax simple form (i'm using slim): <button class="btn btn-default" data-toggle="collapse" data-target="#recurringgift" type="button"> </button> any advice appreciated! 1) simple form, can pass in options input, label, , wrapper. style label use button classes, , set display: none on input itself, since clicking label select checkbox. eg. = f.input_field :some_checkbox, input_html: { style: "display: none"}, label_html: { class: "btn btn-primary"} even better, can put checkbox before label, can use :checked pseudoclass affect label's style: = f.input_field...

oop - Business objects (DTO) in Spring Data JPA -

by default spring data repositories process database entities. please, suggest standard approach of getting same functionality spring data framework, allows operating on business domain objects (dto) instead of entities, , encapsulates dto to/from entity mappings. current obvious options are: additional "proxy-wrapper" methods have same names in spring repository accept , return dto types , encapsulate conversions(mappings). some clever implementation of previous option using aop less boilerplate code. both options seem pretty awkward me such standard task. so, assume jut missing here.

excel vba - Which 'reference' allows Json in VBA -

now, trying use json in vba. reference should used in vba allow json objects, cjobjects? i have tried declare follow: dim myobj cjobject but can't compiler recognize cjobject . actually, cjobject custom class module. so, need related class module using this. actually, has other way parse json in vba. suggested use way this . here reference using cjobject . download, cdataset.xls , check it. helpful you.

Mqtt client program in c -

i'm using dev c++ tool. i'm getting error undefined reference 'mqttclient_create' . part of code of source file(.c) mqttclient_create(&client, address, clientid, mqttclient_persistence_none, null); conn_opts.keepaliveinterval = 20; conn_opts.cleansession = 1;

c# - Accessing previous value in Hashtable during page refresh -

i have hyperlink field in gridview. want store clicked value during session in hashtable hyperlink field. protected partial class user : system.web.ui.page { hashtable htable = new hashtable(); int htableindex = 0; // ... } in page load function. if(session["test"] != null)` { for(int = 0 ; gvuserstatus.rows.count ; i++) hashtable temphashtable = new hashtable(); temphashtable = session["test"] hashtable; if(temphashtable.contains(somevalue)) { //do } } in link click event: protected void userid_click(object sender, eventargs e) { //logic clickedvalue if(!htable.contains(clickedvalue)) { htable.add(htableindex++,clickedvalue); } session["test"] = htable; } i using above code, in hash table, last clicked value getting stored, should previous value entire user session? htableindex lose value upon postback . need store in session (or view...

php - How to make video by uploading 1 audio file and 1 to 10 images using ffmpeg -

in local environment use ffmpeg library make video on windows works fine command line using php exec command. when testing on live server not works fine.i configured ffmpeg on server , test php exec command not work , there no error. is there way use or upload ffmpeg library in live website folder , give proper path in php exec command.

php - Optimize substrings anagram compare algorithm -

im trying solve 1 challenge have check string substrings anagrams. condition s=abba, anagramic pairs are: {s[1,1],s[4,4]}, {s[1,2],s[3,4]}, {s[2,2],s[3,3]} , {s[1,3],s[2,4]} problem have string 100 chars , execution time should below 9 secs. time around 50 secs... below code, appreciate advice - if give me directions or pseudo code better. $time1 = microtime(true); $string = 'abdcasdabvdvafsgfdsvafdsafewsrgsdcasfsdfgxccafdsgccafsdgsdcascdsfsdfsdgfadasdgsdfawdascsdsasdasgsdfs'; $arr = []; $len = strlen($string); ($i = 0; $i < strlen($string); $i++) { if ($i === 0) { ($j = 1; $j <= $len - 1; $j++) { $push = substr($string, $i, $j); array_push($arr, $push); } } else { ($j = 1; $j <= $len - $i; $j++) { $push = substr($string, $i, $j); array_push($arr, $push); } } } $br = 0; $arrlength = count($arr); foreach ($arr $key => $val) { if ($key === count($arr) - 1) { ...

python - Configuring PIP to work from behind a proxy -

i've installed python 3.4.3 comes pip . want use pip behind proxy did following: created c:\users\foo\pip\pip.ini , added proxy configuration section: [proxy] export http_proxy=my_proxy_server:1234 however, when try run pip install packages, timeout messages: c:\users\foo>pip install paramiko requirement satisfied (use --upgrade upgrade): paramiko in c:\python3 4\lib\site-packages\paramiko-1.16.0-py3.4.egg collecting pycrypto!=2.4,>=2.1 (from paramiko) retrying (retry(total=4, connect=none, read=none, redirect=none)) after connec tion broken 'connecttimeouterror(, 'connection pypi.python. org timed out. (connect timeout=15)')': /simple/pycrypto/ any ideas i'm doing wrong? thanks in adv.! you can use following command pip uses proxy. basic format of form: [user:passwd@]proxy.server:port for example: pip --proxy http://<your proxy>:<your port> (for http) pip --proxy https://<your proxy>:<y...

what should be used New() or var in go? -

how object should created struct? object := new(struct) or var object struct i not understatnd when use what? , if both same 1 should prefered? when need pointer object use new or composite literal else use var. use var whenever possible more allocated in stack , memory freed scope ends. case of new memory gets allocated in heap , need garbage collected.

php Class not found but imported -

i have 2 files, first test.php looks this: <?php namespace my\namespaces\test; class test { const alert_email = "alertemail"; const alert_sms = "alertsms"; const alert_notification = "alertnotification"; } // class - enumalerttype ?> and file try use const test.php <?php use my\namespaces\test; $a = test::alert_sms; ?> but still class 'my\namespaces\test' not found error, i'm not sure if i'm using namespace correctly. thanks you need differenciate 2 terms here: including , importing . former add code in current script being executed , latter use them in code. including litteraly copy paste code current script can used later on. thus, need include ( require_once() ) code of class test file use code. can, indeed, import ( use ) afterwards (especially if files in separated folders). therefore, need do: <?php require_once('test.php'); // include code use my\namespaces\test; // i...

android - Robolectric 3 support of Gradle splits -

i have in build.gradle android splits: splits { abi { enable true reset() include 'x86', 'mips', 'armeabi-v7a', 'armeabi' universalapk false } } android.applicationvariants.all { variant -> // assign different version code each output variant.outputs.each { output -> output.versioncodeoverride = versioncodes.get(output.getfilter(outputfile.abi), 0) * 1000000 + android.defaultconfig.versioncode } } after update of robolectric 3.0 become path error: build/intermediates/manifests/full/debug/androidmanifest.xml not found or not file; should point project's androidmanifest.xml because in build/intermediates/manifests/full/ have 4 splits folders armeabi/ armeabi-v7a/ mips/ x86/ how can set in robolectric config or in gradle configuration, have splits? thank you update: in classes have following configuration: @runwith(robol...

oracle - show the hierarchy of tree by showing path to leaf node -

i want write query in oracle can tree hierarchy in 1 row , last node path shown have id , parent id. id parent_id 1 null 2 1 3 2 4 3 5 4 6 5 and output should in 1 row path 1-2-3-4-5-6 use function sys_connect_by_path() , pseudocolumn connect_by_is_leaf : select id, ltrim(sys_connect_by_path(id, '-'), '-') path test connect_by_isleaf = 1 connect prior id = parent_id start parent_id null output , sqlfiddle : id path --- --------------- 6 1-2-3-4-5-6 edit: where clause natural here, reason absolutely don't want it. use: select id, path ( select id, ltrim(sys_connect_by_path(id, '-'), '-') path, connect_by_isleaf leaf test connect prior id = parent_id start parent_id null) connect 1=0 start leaf = 1

c++ - Compiler Error: Undefined symbols for architecture x86_64 (Mac OS X 10.10.4; GLM) -

i have implemented new class sceneobject raytracer project. in project i'm using glm lib tasks. now i'm getting the: undefined symbols architecture x86_64 error when try compile. my compiler: ✘ arneosterthun@arnes-air  ~/documents/studium/programmiersprachen/raytracer/build   sceneobject ●  gcc -v using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper target: x86_64-apple-darwin14.0.0 configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran thread model: posix gcc version 4.9.2 20141029 (prerelease) (gcc) arneosterthun@arnes-air  ~/documents/studium/programmiersprachen/raytracer/build   sceneobject ●  make -v gnu make 3.81 copyright (c) 2006 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. program built i386-apple-darwin11.3.0 this gist on github new implemented cod...

javascript - how to serialize object into json using c# -

i tried using var myobject = jsonconvert.serializeobject(customer); but problem in customer properties firstname , service expecting json input firstname {"firstname":"neo"} statement jsonconvert.serializeobject(customer); gives me {"firstname":"neo"} wrong. so how can change first letter when jsonconvert.serializeobject happened ? or how take 1 parameter input json firstname instead if using customer object. you can define how data need serialized. when using webapi, can define camelcasepropertynamescontractresolver (part of json.net library) formatter in register method of webapi config. public static class webapiconfig { public static void register(httpconfiguration config) { config.formatters.jsonformatter.serializersettings.contractresolver = new camelcasepropertynamescontractresolver(); } } the code above webapi, nevertheless believe simular approach can solution when no...

plsql - How can i fix my trigger to automatically determine if first donation and update single column -

i've hit wall trying create trigger table. have donation table has column (first_donation) checked 'y' or 'n' depending whether donor's first donation or not. want automate process trigger automatically adds 'y' or 'n' if new donation added. if donor submits new donation or first donation column (first_donation) adjusted reflect y or n. first attempt @ triggers , did not seem daunting @ first , language seemed easier last book on java script. guidance appreciated. create or replace trigger first_donation_tg after insert of donation_id --id of donation pledge on tt_donate each row begin if inserting update tt_donation set first_donation := 'y'; else set first_donation := 'n'; end if; end first_donation_tg; below you'll find working example should loking for. don't explain details of basic trigger syntax can read fine manual: pl/sql trigge...

ios - Destroy previous viewController when presenting a new one -

i have application sidebarmenu has 5 sections. in storyboard i've created start mainviewcontroller embedded in navigationcontroller. i've created same 5 vc's , again embed them in navigationcontroller. have 6 vc's, each of wrapped in own navigationcontroller. each vc implements sidebardelegate function has index of selected menu. here code: // sidebartableviewcontroller protocol sidebartableviewcontrollerdelegate { func sidebarcontroldidselectrow(indexpath: nsindexpath) } class sidebartableviewcontroller: uitableviewcontroller { // ... override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: false) println(indexpath.row) delegate?.sidebarcontroldidselectrow(indexpath) } } // sidebar class ------------------------------------------------ @objc protocol sidebardelegate { func sidebardidselectbuttonatindex(index: int) o...