Posts

Showing posts from March, 2010

mysql - Can I use a String as a WHERE CLAUSE -

can me jsp problem. im trying update database using code similar this: so, have on servlet: string querycondition = "id = 1"; that passed stored procedure: create definer=`root`@`localhost` procedure `storedprocedure_1`(querycondition text) begin update users set name = 'john' querycondition; end i thinking if possible because update fail. if isn't possible can recommend how can such thing you can use in stored procedure prepared statement. example : delimiter // create definer=root@localhost procedure storedprocedure_1(querycondition text) begin set @query := concat( 'update users set name = \'john\' ', querycondition ); prepare stmt @query; execute stmt; drop prepare stmt; end; // delimiter ;

html - Use jQuery to check percentage width of div and perform conditional style -

i've got ten instances of .progress. of have percentage based widths. if given instance of .progress on 100% width, i'd style it's backround red , force 100% width. any help? this feeble attempt. if ($( '.progress' ).css("width") > '100%') { $(this).css('background-color', 'red'); // or $(this).addclass('red'); } i think width in % not available in js think should try check target's width parent's width: if ($('.progress').css("width") >== $('.progress').parent().css("width")) { $(this).css('background-color', 'red'); // or $(this).addclass('red'); } or way: $('.progress').each(function(){ var $target = $(this); if ($target.css("width") >== $target.parent().css("width")) { $target.css('background-color', 'red'); // or $target.addclass('re

uitableview - iOS: How can i display the section content in Grouped Table View? -

i using following sample code have section contents in "grouped table view". showing contents in "grouped table view" fine. but, issue is, sorts section content based on alphabetical order, order of section header content not displaying expected. example: want "about" shown @ end of section in tableview, here shows first (because of alphabetical sort there). how can display section content based on below code without alphabetical sorting. please advise! - (void)viewdidload { [super viewdidload]; nsarray *arrtemp4 = [[nsarray alloc]initwithobjects:@"quick logon",@"stay logged on", nil]; nsarray *arrtemp3 = [[nsarray alloc]initwithobjects:@"notifications",@"text messaging",@"family members",@"social media",nil]; nsarray *arrtemp2 = [[nsarray alloc]initwithobjects:@"payment accounts",nil]; nsarray *arrtemp1 = [[nsarray alloc]initwitho

jquery - AJAX Post on Field Completion? -

i have code below validates form field called lms_domain. checks whether subdomain selected user available using ajax call file executes mysqli count query. code works on submission of form execute ajax post when user types field, or has completed field. how achieve using jquery? $('#lms_name').keyup(function(){ /* code here */ $.ajax({ type: 'post', url: 'assets/lmsdomaincheck.php', data: "lmsdomain="+value+".thedomain.com", async: false, success: function(htmldata){ if (htmldata=="success") { $('#spanlmsdomain').html('good'); }else { msg+="<b>error on lms domain name : </b>"+value+".thedomain.com not available.<br/>"; $('#spanlmsdomain').html('bad'); } } }); /* code here */ }); thanks in advance tips!

c# - How to select from DropDownList in HttpWebRequest -

1.httpwebrequest+httpwebresponse login go page "ex.asps" 2.send httpwebrequest(with select option ddl)+httpwebrespons save info need streamreader. 1.i succeed see info work 2.i see dll(id, options,values,name) cant find out way select right option can see , save first one,nut need go trow ddl select 1 one , save data. ex: ddl 4 user , each 1 have own data (age,id...) can save 1 user need change ddl new data this code if (islogin) { httpwebresponse redirectresponse = redirecttourl("https://services.test.com/pages/trans.aspx"); stream streamresponse = redirectresponse.getresponsestream(); streamreader streamread = new streamreader(streamresponse); outstring = streamread.readtoend(); system.collections.arraylist straccountlist = getlistbyid("ctl00_placeholdermain_accountsddl_ddlaccounts"); (int intaccountcount = 0; intaccountcount < straccountlist.count; intaccountcount++) { string[] stracctli

printing - Python stdin request coming before stdout prints -

i've been trying learn python 3.3 , run problem. here test code using: print('should print before stdin') x = raw_input('enter something: ') and here output looks like: >>something should print before stdin enter something: why print statements coming after stdin? in python 3.x, raw_input("") has been eliminated , use input() instead. refer docs . print('should print before stdin') x = input('enter something: ') output should print before stdin enter something: yes process finished exit code 0

javascript - Can't get colour of div to change using loop / switch statement combination -

i'm trying make simple memory game, shape flashes on screen x number of times , user has remember colour. i'm trying use loop combined switch statement change colour on each iteration. however, colour not change , i'm stuck. can tell me i'm doing wrong? code follows: $(document).ready(function() { var colorarray = []; // stores colours have been generated var changecolour = function(){ var generateshape = math.floor(math.random() * 5) // generates number 0-4 switch (generateshape){ case 0: $('#shapediv').css('background-color','black'); $('#shapediv').fadeout(500); colorarray.push('b'); break; case 1: $('#shapediv').css('background-color','red'); $('#shapediv').fadeout(500); colorarray.push('r'); break; case 2:

android - Using of JSON Parsing in MainActivity send FATAL ERROR -

i've got error when want parse json: 04-06 13:39:13.517: w/dalvikvm(2582): threadid=1: thread exiting uncaught exception (group=0xa62f9288) 04-06 13:39:13.521: e/androidruntime(2582): fatal exception: main 04-06 13:39:13.521: e/androidruntime(2582): java.lang.nullpointerexception 04-06 13:39:13.521: e/androidruntime(2582): @ jsonparser.gettunes.onpostexecute(gettunes.java:207) 04-06 13:39:13.521: e/androidruntime(2582): @ jsonparser.gettunes.onpostexecute(gettunes.java:1) 04-06 13:39:13.521: e/androidruntime(2582): @ android.os.asynctask.finish(asynctask.java:631) 04-06 13:39:13.521: e/androidruntime(2582): @ android.os.asynctask.access$600(asynctask.java:177) 04-06 13:39:13.521: e/androidruntime(2582): @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:644) 04-06 13:39:13.521: e/androidruntime(2582): @ android.os.handler.dispatchmessage(handler.java:99) 04-06 13:39:13.521: e/androidruntime(2582): @ android.os.looper.loop(looper.ja

javascript - depending loops with ajax request inside -

hi im using jquery run several ajax request in loops built html table. how can make them run in specific order? i tryed $.when , in case seem work using async: false, i got 2 main functions 1) building ajax request url inside loop for (var = 0; < split.length; i++) { zeile = split[i]; request = $.ajax({ url: "url.php?q=" + zeile, and drawing basic table success: function(data) { $.each(data.data, function(key, val) { p = p + "<td>...</td>" p = p + "<td>...</td>" p = p + "</tr>"; $("#htmlergebnis").append(p); after different request finished , complete table drawn want run second function, adds table cells data source. therefor uses value out of each existing row (drawn first loops) search value request $(".ergebniszeile" ).each(function(key) { ...

c++ - creating full range of random floats using std::random -

i'm attempting test mathematical class i've created using random numbers full range of representable positive float s, find seem having problem use of std::random . program #include <random> #include <iostream> #include <functional> template <typename t> class rand { public: rand(t lo=std::numeric_limits<t>::min(), t hi=std::numeric_limits<t>::max()) : r(bind(std::uniform_real_distribution<>(lo, hi),std::mt19937_64{})) {} t operator()() const { return r(); } private: std::function<t()> r; }; int main() { rand<float> f{}; const int samples = 1000000; float min = std::numeric_limits<float>::max(); float max = std::numeric_limits<float>::min(); std::cout << "range min = " << max << ", max = " << min << '\n'; (int i=0; < samples; ++i) { float r = f(); if (r < min) mi

java - Post request from Android application failing + RestEasy + Jackson -

i trying send post request android application , mediatype conflict error or @ least that's think. want send data request , should work think missing something. using jackson , resteasy come wildfly server. here error log server: 15:18:20,790 warn [org.jboss.resteasy.core.exceptionhandler] (default task-6) failed executing post /posts/post: org.jboss.resteasy.core.nomessagebodywriterfoundfailure: not find messagebodywriter response object of type: domains.post of media type: application/octet-stream @ org.jboss.resteasy.core.serverresponsewriter.writenomapresponse(serverresponsewriter.java:67) [resteasy-jaxrs-3.0.6.final.jar:] @ org.jboss.resteasy.core.synchronousdispatcher.writeresponse(synchronousdispatcher.java:427) [resteasy-jaxrs-3.0.6.final.jar:] @ org.jboss.resteasy.core.synchronousdispatcher.invoke(synchronousdispatcher.java:376) [resteasy-jaxrs-3.0.6.final.jar:] @ org.jboss.resteasy.core.synchronousdispatcher.invoke(synchronousdispa

javascript - JQueryUI: Button inside a draggable div not working when div is dropped -

first post on stackoverflow. i tried resume issue in title, , made jsfiddle here: http://jsfiddle.net/gbbcj/ the html generated seems correct, button in dragged div not work. tried redefine .button(), no success. thanks help! $(".box").draggable({ helper: 'clone' }); $("#left").droppable({ accept: '.box', drop: function (e, ui) { $(this).append('<div class="box"></div>'); var droppedbox = $(this).children().last(); $(droppedbox).html(ui.helper.html()); } }); $(".mybutton").click(function () { alert("clicked"); }); use .on() read event delegation syntax $( elements ).on( events, selector, data, handler ); $(".container").on('click', '.mybutton', function () { alert("clicked"); }); fiddle demo

java - Spring security with different type of sessions -

i'm using spring security 3.1.4 , have following problem. in 1 web app have 2 types of users different custom "userdetails" instance. how differentiate between users in implementation of userdetailsservice.loaduserbyusername. can have 2 userdetailsserviceimpl , know when use each one? well, suggest implement composite userdetailsservice , perform loaduserbyusername both db 1 one. , logical, first userdetailsserviceimpl use should regular user , tipical, count of admin user less. however design looks bad. better have separate hidden application admins , rid of little vulnerability when simple user might guess admin account.

sql - How to extract data from Access db and place it into a text box using vb.net? -

hi guys i'm trying search employee information using sql ms access, , hoping put fname lname , such details in respective textbox correspond specific employee's id number. have managed make sql work don't know how extract files sql statement , place inside .text(text box), can please guide me? thanks here code far: (updated code) got error message : additional information: executereader: connection property has not been initialized. highlighting reader below. how can fix this? i'm trying extract data , place textbox? thanks private sub enumtext_selectedindexchanged(sender object, e eventargs) handles enumtext.selectedindexchanged dim dbsource = "data source= c:\databse\company_db.accdb" con.connectionstring = "provider=microsoft.ace.oledb.12.0; data source= c:\databse\company_db.accdb" dim sqlquery string dim sqlcommand new oledbcommand dim sqladapter new oledbdataadapter dim table new datata

indexing - MySQL is not using index on very simple GROUP BY query -

Image
here table create/schema: create table `_test` ( `id` int(10) unsigned not null auto_increment, `group_id` int(10) unsigned not null, `total` int(10) unsigned not null, primary key (`id`), key `group_id` (`group_id`) ) engine=myisam auto_increment=1 default charset=latin1 so 2 keys - primary on id , index on group_id. and here data sample: now, thing when run explain following simple query: explain select sum( total ) _test group (group_id) i getting no use of key despite 1 being created on group_id column: any ideas why mysql not trying use group_id index query?

javascript - Node js custom callback function error -

i'm trying make simple authentication node js. because read user data database, have make asynchronous. here's function, checks if authentication ok: function auth(req, callback) { var header = req.headers['authorization']; console.log(cb.type); console.log("authorization header is: ", header); if(!header) { callback(false); } else if(header) { var tmp = header.split(' '); var buf = new buffer(tmp[1], 'base64'); var plain_auth = buf.tostring(); console.log("decoded authorization ", plain_auth); var creds = plain_auth.split(':'); var name = creds[0]; var password = creds[1]; user.findone({name:name, password:password}, function(err, user) { if (user){ callback(true); }else { callback(false); } }); } } and here call function:

php - Yii insert record instead of update -

i'm using yii framework regarding php code. i have 3 methods in controller, 1 creating, 1 updating, 1 saving. creating , updating render same form. everything works fine saving record. when updated record, creates new record. in update method, load existing record , correct value, when save saves in new record. i'm try $model->update() instead of $model->save(), got error cannot update new record. thank in advance insights method create $model = new comment; $this->renderpartial('_formcomment',array( 'model'=>$model, 'post_id'=>$post_id,) ); method update $model=$this->loadmodel($comment_id); $this->renderpartial('_formcomment',array( 'model'=>$model, 'post_id'=>$model->post_id, 'comment_id'=>$model->id,) ); method save $comment=new comment; if(

c# - Object reference not set to an instance of an object. using Emgu CV -

please guys me resolving issue in following statement: mcvavgcomp[][] detector = imagegray.detecthaarcascade(face, 2.1, 10, emgu.cv.cvenum.haar_detection_type.do_canny_pruning, new size(20, 20));" after debugging solution compiler show me following error: object reference not set instance of object. because you're dealing haar cascade logic, imagegray looks gray scale image of type image<gray, byte> imagegray; ensure correctly initialized or converted rightly frame. check not null. and in line: imagegray.detecthaarcascade(face, 2.1, 10, emgu.cv.cvenum.haar_detection_type.do_canny_pruning, new size(20, 20)); face variable initialized like: var face = new haarcascade("haarcascade_some_tree.xml"); ensure face not null. if both variables not null, detecthaarcascade method expects fields in face object non-null , finding null. ensure if face object fields non-null. (some key ones once variable initialized)

Posting JavaScript Value to PHP via Ajax issue -

i need value jquery php can search function site. i have tried: <script> $(document).ready(function () { $('#search_button').click(function(e){ e.preventdefault(); e.stoppropagation(); carsearch(); }); }); function carsearch() { $.ajax({ type: "post", url: 'cars.php', data: { mpg : $('.mpg').val() }, success: function(data) { alert("success! "+$('.mpg').val()+"mpg"); } }); } </script> this ajax running when button pressed , js value there displayed in alert. however if(isset($_post['mpg'])) { $query = "select * cars mpg =< ".($_post['mpg']).""; echo "<div class='test'></div>"; } else {

bash - C system() call parameter expansion -

i'm trying merge set of files using c system() call: int main(int argc, char* argv[]) { return system("cat output{1,2} > merged.out"); } the result is: $ gcc test.c $ ./a.out cat: output{1,2}: no such file or directory it works if directly in bash: $ ls output{1,2} output1 output2 $ cat output{1,2} 1,2 3,4 how can enable parameter expansion in system() call? the reason system uses /bin/sh , not expand braces. instance, try: /bin/sh -c 'echo cat output{1,2}' and compare /bin/bash -c 'echo cat output{1,2}' if must, like system("/bin/bash -c 'cat output{1,2} > merged.out'"); but why not read both files , write output merged.out ?

java - How can I subtract from arraylist some values ? -

here example: public static arraylist<integer> position = new arraylist<integer>(); public static arraylist<integer> new_position = new arraylist<integer>(); collections.copy(new_position, position); (int j = 0; j < position.size(); j++) { new_position.get(j) -=4; } i want copy values , new arraylist subtract 4. how can make ? i'm new in java. i've got error such as: the left-hand side of assignment must variable , refers nowe_pozycje.get(j) -=4; . you have get() value, change it, , set() new value: for (int j = 0; j < position.size(); j++) { new_position.set(j, new_position.get(j) - 4); } an alternative solution skip whole copying of list, , instead iterate through original list, change each value go, , add them new list : public static arraylist<integer> new_position = new arraylist<integer>(); (integer i: position) { new_position.add(i - 4); }

php - Need of Controllers in codeigniter? -

what controllers in frameworks ? please answer not developer point of view logical point of view. why need ? main core purpose of controllers ? controllers used split application logic presentation or storage logic. the models store data , associated manipulation methods. views designed hold data relevant presenting data. this leaves gap of how link data correct view , how control actions on data. purpose controller added. controller quite aptly controls how data manipulated , presented. as such controller serves purpose of acting bridge between users request , system user interacting with. instance if user manipulating forms change stored data controller takes responsibility checking data submitted user before manipulating stored data. in broader sense of word controller there separation of concerns. models need concerned on how store , manipulate data. don't have worry on how user interacts or how presented user. views likewise deal presentation don't c

image - Htaccess rewrite if filename contains specific suffix -

i'd rewrite every image (png|webp|jpeg) name filename-tn.xyz filename-200x200.xyz . how replace variable without changing rest of url? thanks in advance. this should work. should rename png , jpeg , webp rewriteengine on rewriterule ^(.*)-tn\.(png|jpeg|webp)$ /$1-200x200.$2 [r,l] edit: rename image, keep old name in url bar. rewriteengine on rewriterule ^(.*)-tn\.(png|jpeg|webp)$ /$1-200x200.$2 [l]

polymorphism - Call a derived method from a object in a base vector c++ -

i have doubt polymorphism in c++. have following structure: quaternions.h #ifndef quaternions_h #define quaternions_h #include <math.h> #include <ostream> using namespace std; class quaternions { private: float z; float y; protected: float w; float x; public: quaternions(); quaternions(float w, float x, float y, float z); float module() const; quaternions conjugate(); quaternions operator +(const quaternions quat); quaternions operator -(const quaternions quat); quaternions operator *(const quaternions quat); quaternions operator /(const quaternions quat); friend ostream& operator <<(ostream& os, const quaternions& quat); float getx() const; float getw() const; void setx(float x); void setw(float w); float gety() const; float getz() const; void sety(float y); void setz(float z); ~quaternions(); }; #endif quaternions.cpp #include "quaternion

c# - Out of Memory Exception in Parallel.ForEach -

i using parallel.foreach job got "out of memory exception". parallel.foreach(flist, (item) => { string f1 = item.split('|')[0]; string f2 = item.split('|')[1]; = file.readalltext(f1); b = file.readalltext(f2); consume(a, b); }); flist 's size 351, a , b string, each of them has 20kb size. @ time, system memory blown up. consume return string list, around 1000 strings in each iteration. how deal it? try replacing: parallel.foreach(flist, (item) => { string f1 = item.split('|')[0]; string f2 = item.split('|')[1]; = file.readalltext(f1); b = file.readalltext(f2); consume(a, b); }); with: parallel.foreach(flist, new paralleloptions { maxdegreeofparallelism = 4 }, (item) => { string f1 = item.split('|')[0]; string f2 = item.split('|')[1]; = file.readalltext(f1); b = file.re

c++ - Qt executable error- dll library -

a qt application runs when executed qtcreator, doesn't wont run when try execute debug folder (without qtcreator). asked lots of .dll files , downloaded them 1 one,and added debug folder. got error: the program can't start because libwinpthread-1.dll missing computer. try reinstalling program fix problem. i can't find libwinpthread-1.dll anywhere on internet. did wrong? the path executable is: c:\qt\tools\qtcreator\bin\build-simpletext1_3-desktop_qt_5_2_1_mingw_32bit\debug the project file: #------------------------------------------------- # # project created qtcreator 2014-04-04t14:29:48 # #------------------------------------------------- qt += core gui greaterthan(qt_major_version, 4): qt += widgets target = simpletext1_3 template = app sources += main.cpp\ mainwindow.cpp headers += mainwindow.h forms += mainwindow.ui config += console c++11 qmake_cxxflags += -std=c++11 and main.cpp: #include "mainwindow.h" #include

listview - Android - shortcut icons in custom list adapter (google play music) -

Image
i'm trying reproduce list view on google play music but i'm not sure best way go loading options "start instant mix" or "go artist" upon clicking button looks action overflow in list view. treat them menuitems? if so, callback method use? the reason want use shortcut in listview because want user able see related albums song on, cannot fit in tiny list view because there might 8 pictures in total. related songs in list view well, suppose best design choice. i think figured out. reproduced making imageview onclicklistener loads listpopupwindow in listadapter. imageview src used standard menu overflow drawable.

jquery ui - Basic jQueryUI function for image uploader -

i've been trying wrap head around basic javascript/jquery task. i've made basic image uploader following html: div class="button one"></div> <div class="button two"></div> <div class="size ui-widget-content"> <img src="" alt="" /> <input type='file' name='userfile'> </div> <div class="button three"></div> this code i've got far, jqueryui plugin: $( ".size" ).resizable( { grid: [60, 24], ghost: true, aspectratio: //ratio function here , stop: function( event , ui) { var height = $(".size").css( "height" ); var width = $(".size").css( "width" ); $( ".size img" ).css( { width : width, height: height }) } }); $( ".size > input" ).change(function() { var filename = $('input[type

how "%c" specification works with scanf()? -

i have following code char c; scanf("%c",&c); now have read "%c" consume whitespaces including enter .but why when press enter (before pressing character) %c not accepting it? so why accept enter key present in buffer due previous calls , not accept enter key before pressing character? i assume question why inputs, including enter , not passed scanf(). not %c or %d or other type. see, special characters esc not passet io functions. recognized by, instance, console opens when executing code.

c++ - multi_index template compiling error -

2 questions: 1. need pass parameter modify/modify_key via member? 2. why have compilation error to see entire code error, can @ http://coliru.stacked-crooked.com/a/d6241361318e1925 the error multiindex4.h: in member function 'uint32_t crmultiparametermultiindex::modifykeyby(searchingkey&, modifykeytype&) [with searchingtagtype = imei_tag, modifyingtagtype = imei_tag, searchingkey = uint32_t, modifykeytype = uint32_t]': multiindex4.h:183: instantiated here multiindex4.h:119: error: no matching function call 'boost::multi_index::multi_index_container<userskey, userskey_indices, std::allocator<userskey> >::modify_key(boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<userskey, std::allocator<userskey> > > >&, boost::function<void ()(uint32_t&)>&)' *** errors occurred during build *** i have class crmultiparam

Matching email ids to people names -

i have database(say 5000 records) full of people names(first , last name). have huge set of email ids (say around 30000). have match these email ids people names ever possible , discard other ids. doing is, have made patterns like: 1. firstname.lastname@something.com 2. lastname.firstname@something.com 3. firstname_lastname@something.com 4. lastname_firstname@something.com etc i trying use fuzzy search in both first , last names following above patterns. people tend use lot of patterns in email ids. of tend more 1 result people. there better way increase probability in matching emails correctly. searching lot , didn't find solid ideas. to make bit smarter assume non alpha numeric name separator , use regular expression, e.g. $jan[^a-z0-9]smith@.*^ but doesn't multiple matches. think it's inevitable you'll false positives email format not constrained. given size of database think you're stuck doing of hand :(

Delete limited n rows from oracle sql table -

i want delete 2 rows/records each employee working in more 3 projects. let's have table: +----------+-------------+ | employee | project | +----------+-------------+ | 1 | p1 | | 1 | p2 | | 1 | p3 | | 1 | p4 | | 2 | p1 | | 2 | p3 | | 3 | p1 | | 3 | p4 | | 3 | p5 | +----------+-------------+ i can query witch employees working in more 3 projects. in case employee id 1 , employee id 3. query should be: select employee ( select employee, count(*) my_count my_table group employee ) vw vw.my_count >= 3; it not important rows delete, relevant delete 2 rows/records every employee works in more 3 projects. resulting table example: +----------+-------------+ | employee | project | +----------+-------------+ | 1 | p1 | | 1 | p2 | | 2 | p1 | | 2 |

C++ boost::regex multiples captures -

i'm trying recover multiples substrings boost::regex , put each 1 in var. here code : unsigned int = 0; std::string string = "--perspective=45.0,1.33,0.1,1000"; std::string::const_iterator start = string.begin(); std::string::const_iterator end = string.end(); std::vector<std::string> matches; boost::smatch what; boost::regex const ex(r"(^-?\d*\.?\d+),(^-?\d*\.?\d+),(^-?\d*\.?\d+),(^-?\d*\.?\d+))"); string.resize(4); while (boost::regex_search(start, end, what, ex) { std::string stest(what[1].first, what[1].second); matches[i] = stest; start = what[0].second; ++i; } i'm trying extract each float of string , put in vector variable matches. result, @ moment, can extract first 1 (in vector var, can see "45" without double quotes) second 1 in vector var empty (matches[1] ""). i can't figure out why , how correct this. question how correct ? regex not correct ? smatch incorrect ? firstly, ^ symb

get the nearest highest value from a list oracle sql -

i have column in database in following format: yymmddhh24miss sample data: 140203101241 140202101141 140102101240 143001101244 142801101245 142701131347 142601121542 142101131744 ... i need nearest high value list. ex: if pass 142701131333, should return 142701131347 above list. any appreciated! select data ( select data tbl data > '142701131333' order data ) rownum = 1

AngularJS Multi-Level Default Routes -

in angularjs, wanted send routes single controller - figured - why set routing @ all? it seems simpler route information $window.location.pathname.split("/"); at first, looked plan: 'mysite.com' worked 'mysite.com/' worked 'mysite.com/home' worked but when try 2-level or 3-level route: 'mysite.com/team/my-name' 'mysite.com/blog/post/my-post' angular crashes saying: uncaught syntaxerror: unexpected token < why isn't angular default routing ok multi-level routes? the angular router not meant (yet). try ui router expecting.

arrays - PHP : foreach - Return issue (after first occurence) -

issue resolved , here solution : function finaltimetestt() { $timecheckarray = maketimecheck(); $tbool = true; if(count($timecheckarray) >0) { foreach($timecheckarray $tca) { if($tca['value'] != "true") { $tbool = false; return array($tbool , $tca['courseid'] , $tca['day']); break; } else { // nothing } } } else { return array($tbool); } return array($tbool); } i'm having small problem code , driving me crazy : i want go through multi-dimensional array , if 1 of values false , should out of loop , return value - break; doesn't seem working , returning true tho there 1 occurence of "false" $timecheckarray gives : arra

java - Displaying text in a field -

i making simple true or false quiz game, dont know text field should use display quiz questions. tried jtextfield can edit text in it.. want question strings taken question class , displayed in text area. quiz class public class quiz { private jframe frame; private jbutton yesbutton; private jbutton nobutton; /** * creates game interface */ public quiz() { makeframe(); } /** * receive notification of action. */ public void actionperformed(actionevent event) { system.out.println("menu item: " + event.getactioncommand()); } /** * quits application. */ private void quit() { system.exit(0); } /** * pop up. */ private void about() { joptionpane.showmessagedialog(frame, "quiz game version 1.0", "about quiz", joptionpane.information_message);

sql - ORACLE: ORA-02013: missing CONNECT keyword -

when executing script using sql developer 4.0 against oracle 11.2 express database alter user tms quota 100m on tdm grant unlimited tablespace tms i following error: ora-02013: missing connect keyword 02013. 00000 - "missing connect keyword" *cause: *action: upfront did connect localhost / xe. i tried connect sys sysdba and entered password. create table statements fail same result. the problem trying execute 2 commands one. put semicolon @ end of each of them , work: alter user tms quota 100m on tdm; grant unlimited tablespace tms; check possibilites of alter user command here: alter user - oracle documentation

javascript - Update a value for existing documents with Mongoose? -

i have document field 'position', used sorting results via angular loop on frontend. right now, schema accurately auto-incrementing new documents lack 'position', , storing new documents have form-field-entered position. when inserting item existing 'position' value, want move every record down. wrote javascript logic this, doesn't hit else if.. // load mongoose since need define schema , model var mongoose = require('mongoose'); var itemschema = mongoose.schema({ title : string, position: number }); // before validation starts, number of items counted..afterwards, position set itemschema.pre("validate", function(next) { var doc = this; // if 'position' not filled in, fill in..not using !position because 0 might valid value if(typeof doc.position !== "number") { // count number of items * // use mongoose.model fetch model because model not compiled yet mongoose.mode