Posts

Showing posts from September, 2012

java - JPA Join Column -

i have 3 tables in database. first one(categories) includes: id, category, isactive second one(menu) includes: parentid , childid. third one(items) includes: id, name , price. first table has relationship second. want relationship between second , third now. second table has these values in database: 7(id), book1(name), 120(price) 7(id), book2(name), 100(price) 8(id), car1(name), 1620(price) 8(id), car2(name), 520(price) 8(id), car3(name), 5520(price) 9(id), house1(name), 10000(price) 9(id), house2(name), 11000(price) 9(id), house3(name), 15000(price) at moment have joined column childid column id. menu.java @embeddedid menuid id; @column(name="parentid") private integer parentid; @column(name="childid") private integer childid; @onetoone @joincolumn(name="childid",referencedcolumnname="id") private categories subcategories; public categories getsubcategories() { return this.subcategories; } public void se...

php - Insert image into sql server db with pdo -

$stmt=$con->query("insert tbl(data) values(0x".$data1['hex'].")"); this sql statement , works fine. value 0xffd8ffe000104a46494600010101006000600000ffdb00430... gets stored on database , have checked, image gets stored. trying using pdo , stored value different , not show image. here code $datastring = file_get_contents("image.jpg"); $data1 = unpack("h*hex", $datastring); $data = '0x'.$data1['hex']; $stmt=$conp->prepare("insert tbl(data) values(:data)"); $stmt->bindparam(':data', $data); $stmt->execute(); the value in database 0x30786666643866666530303031303461343634393436303... what making difference? doing wrong it? using sql server 2008r2 microsoft pdo_odbc driver on php 5.6. first google hit mssql varbinary pdo : https://social.msdn.microsoft.com/forums/sqlserver/en-us/221dcea2-438d-4a3a-b438-b98bff8f3d57/using-pdostatementbindvalue-to-update-varbinary-fields ...

Differences between scanf and getchar in C -

i trying explain friend c coding , asked me why code (with "scanf") didn't work. #include int main() { char x=scanf("%c",&x); printf("%c\n",x); return 0; } and 1 yes #include <stdio.h> int main() { int k; char x=getchar printf("%c\n",x); return 0; } when scanf completes, x contains character read. however, value overwritten when x assigned return value of scanf , number of items matched or eof in event of error. if call scanf without assigning return value x should expected result. for example, should work. char x; scanf("%c",&x);

python - Cannot resole keyword 'carmodel' into field. Choices are: exterior_color, id, interior_color -

as want filter on foreign key, used carmodel __ in method dropdownlistsearch() of views.py . when run code, tells must field. don't understand part. why error. , using django 1.6.5. models.py from django.db import models class carinfo(models.model):0 vin_number = models.charfield(max_length = 17) model = models.foreignkey(carmodel) timestamp = models.datetimefield(auto_now_add = true, auto_now = false) updated = models.datetimefield(auto_now_add = false, auto_now = true) def __unicode__(self): return self.vin_number class carmodel(models.model): model = models.charfield(max_length = 60) def __unicode__(self): return self.model views.py def dropdownsearch(request): try: q = request.get.get('q') except: q = none if q: cars = carinfo.objects.filter(carmodel__model__contains=q) template ='productions/resultstwo.html' else: template = '...

jquery - How can I get an input text to expand its digits to two if the user only enters one? -

i want display values in text inputs in "dollar format"; iow, instead of "10.5" want "10.50" i able in grand total box (last line of code): $(document).on("blur", '.amountbox', function (e) { var amount1 = $('[id$=boxamount1]').val() != '' ? parsefloat($('[id$=boxamount1]').val()) : 0; var amount2 = $('[id$=boxamount2]').val() != '' ? parsefloat($('[id$=boxamount2]').val()) : 0; var amount3 = $('[id$=boxamount3]').val() != '' ? parsefloat($('[id$=boxamount3]').val()) : 0; var amount4 = $('[id$=boxamount4]').val() != '' ? parsefloat($('[id$=boxamount4]').val()) : 0; var amount5 = $('[id$=boxamount5]').val() != '' ? parsefloat($('[id$=boxamount5]').val()) : 0; var grandtotal = amount1 + amount2 + amount3 + amount4 + amount5; $('[id$=boxgrandtotal]').val(parsefloat(grandtotal).tof...

javascript - Creating a new collection inside existing collection -

i trying put backbone model inside existing model. wondering if possible. var rf = this.collection.create(attrs, options); model.set(table, rf); thanks what trying "nested models & collections". backbone has preferable approach . common idea consist in storing of nested model directly in instance of model instead attributes. so, create child model first , pass parent model through options following: var rf = this.collection.create(attrs, options); var model = backbone.model.extend({ initialize: function(attributes, options) { _.isobject(options) || (options = {}); if (options.child) { this.child = new options.child; } } }); var model = new model({}, {child: rf}); if want supported tree-like backbone models try use 1 of following plugins . hope helps!

drupal - Extending Context List module to show names of blocks/nodes -

i did search on this, found nothing , custom module. called context list named , extends context list module blocks show titles instead of node or block number. project maintainer created 2 hooks me, have not been able figure out how working. here function: function context_list_named_context_list_reaction_block_name(&$block_name, &$details) { if(preg_match('/^nodeblock:(\d+)$/', $block_name)) { $block = block_load('nodeblock',$details->delta); $block_name = $block->subject; //$block_name = ; } elseif(preg_match('/^block:(\d+)$/', $block_name)) { $block = block_load('block',$details->delta); $block_name = $block->subject; //return $block_name; } $block_name = 'test'; } so can see trying set $block_name = 'test'; started, not seeing change on context list page . (context block info module offers same type of list node/block numbers well.)

c - Determine optimization level in preprocessor? -

-og relatively new optimization option intended improve debugging experience while apply optimizations. if user selects -og , i'd source files activate alternate code paths enhance debugging experience. gcc offers __optimize__ preprocessor macro , set 1 when optimizations in effect. is there way learn optimization level, -o1 , -o3 or -og , use preprocessor? i believe not possible know directly optimization level used compile software not in the list of defined preprocessor symbols you rely on -dndebug (no debug) used disable assertions in release code , enable "debug" code path in case. however, believe better thing having system wide set of symbols local project , let user choose use explicitly.: myproject_dndebug myproject_optimize myproject_optimize_aggressively this makes debugging or differences of behavior between release/debug easier can incrementally turn on/off different behaviors.

c# - Dealing with very large Lists on x86 -

i need work large lists of floats, hitting memory limits on x86 systems. not know final length, need use expandable type. on x64 systems, can use <gcallowverylargeobjects> . my current data type: list<rawdata> param1 = new list<rawdata>(); list<rawdata> param2 = new list<rawdata>(); list<rawdata> param3 = new list<rawdata>(); public class rawdata { public string name; public list<float> data; } the length of paramn lists low (currently 50 or lower), data can 10m+. when length 50, hitting memory limits ( outofmemoryexception ) @ above 1m data points, , when length 25, hit limit @ above 2m data points. (if calculations right, 200mb, plus size of name, plus overhead). can use increase limit? edit: tried using list<list<float>> max inner list size of 1 << 17 (131072), increased limit somewhat, still not far want. edit2: tried reducing chunk size in list> 8192, , got oom @ ~2.3m elements, task man...

android - Make AutoCompletionTextView show suggestions not complement of text -

i want make autocompletiontextview show suggestions the behavior in data arrayadapter , make suggestions suggestions list list of texts have same sequence of characters like type abc , data list have [ abc , fabc, geabcr, fgkd, abcg, meow] , suggestions [abc, fabc, geabcr ,abcg](see suggestions have abc in them)

html - How can i get my slideshow to stop changing size? -

i can't seem html/css slideshow stoping changing size. dont know how else explain better "changing size" go check out yourself:(to slideshow load scroll down on page up) dogmother.ca . have tried change of css stop cant work same html. if has ideas please tell me need fixed possible. the index.html slideshow source code: <div class="slider"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoslider"> <img src="images/banner1.jpg" /> <img src="images/banner2.jpg" /> <img src="images/banner3.jpg" /> <img src="images/banner4.jpg" /> <img src="images/banner5.jpg" /> </div> </div> </div> the css slide show can found here: http://dogmother.ca/css/slider.css ...

android - Progress visibility not working in list view footer -

i using pagination in list view , displaying progress bar(small) in list view footer when user scroll down end of list view. layoutinflater inflater = (layoutinflater)getactivity().getsystemservice(context.layout_inflater_service); view view = inflater.inflate(r.layout.list_footer, null); mylistview.addfooter(view). then setting adapter follows progressbar progressbar = (progressbar) getfooterview().findviewbyid(r.id.progressbar); madapter = new myadapter(baseactivity.getactivity(), 0, progressbar, myarraylist); mlist.setadapter(madapter); in adapter class settings progress bar visibility in getview() method follows. if(position == max_records) { progressbar.setvisibility(view.visible); // code goes here. } else progressbar.setvisibility(view.gone); but progressbar not disappears when list has no data fetch. please me. set progressbar visible state , use same code itself.

c# - Expression Tree - Math.Max replacement -

when use expression trees replace method, such math.max, looks replaces in expression tree. when go use in entity framework, throws exception not supporting math.max entity framework. explicitly replacing it. does know why? , way fix code? using system; using system.collections.generic; using system.linq; using system.linq.expressions; namespace consoleapplication1 { public static class calculatedatabase { public static void main(string[] args) { var calcs = getcalculatetoamounts(gettestitems(), 0.5m).tolist(); } public static iqueryable<item> gettestitems() { var items = new list<item>(); items.add(new item() { donotitem = true, reductionamount = 2, previousdiscountamount = 3, currentdiscountamount = 10, currentamount = 100, previousamount = 50, currentbill...

vb.net - RichTextBox get string from Index -

how can string index in richtextbox, that: msgbox(richtextbox1.text(1, 5)) thanks! richtextbox.text returns string , has string.substring() . should like: dim s string = richtextbox1.text.substring(1, 5)

html - How can I float an image left outside of the container when dealing with Jinja templating? -

i'm working on project using flask takes advantage of jinja templates. layout.html file contains grey colored container extended other child pages. 1 of pages extends layout.html, have image float left outside of container. tried setting css position absolute no avail. there else besides making page seperate layout.html? keep container. here's layout.html: <!doctype html> <html> <head> <link rel="icon" type="{{url_for('static',filename ='img/favicon-32x32.png')}}" sizes="32x32" /> <title>foodie</title> {% messages = get_flashed_messages() %} {% if messages %} <ul class=flashes> {% message in messages %} <li>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endwith %} <link rel="stylesheet" href="{{url_for('static', f ilename='css/main.css') }}"...

c++ - Calling functions within namespaces -

is possible call function within namespace? need because function assigns meaningful values variables. if not, there workaround? idea of want below, foo function within variables assigned values, , bar1 , bar2 2 variables given values. namespace space{ bar *bar1; bar *bar2; void foo(bar *b1, bar *b2) {/*b1 , b2 , given values*/} foo(bar1, bar2); // foo function call. } to clarify, bar1 , bar2 should defined first time called , no other time. this does, believe, op wants, it's horrible. every cpp file includes space.h going instantiate bar's 1 , 2 , init. naming collision hell when linker tries sort out. #ifndef space_h #define space_h #include <iostream> namespace space { class bar { public: // use own stuff here. sample use only. bar(const std::string & str):mstr(str) { } friend std::ostream &operator<<(std::ostream & out, const bar &bq) { ...

algorithm - Ideas for Building Bridges on topcoder DIV1-1000 -

i practicing topcoder when encountered following problem: http://community.topcoder.com/stat?c=problem_statement&pm=13417&rd=16464 i in div2 constraints easier, brute force checking each of possible bridge location worked. tried hard think div 1 problem (n<=200) , brute force never pass. can't think of straight forward way can not apply dp or greedy or know. glad if give pointers or hints correct direction problem. on other forums people seem going brute force approach.

http - Login and post using curl in one command -

i configuring solar device on field runs small web server upload data web service. however web service needs have authentication , ssl. there way configure upload url endpoint not way save headers file etc. is possible login pass headers next request , post data in 1 request? something curl -d "email=sadf@yahoo.com&password=asds&submit=login" --dump-header headers http://localhost:3000/users/login **>** curl -x post http://localhost:3000/test --data-urlencode point="<status>a note</status>" -h 'content-type: application/xml '

How can I call a class method in Ruby with the method name stored in an array? -

i working on poker game in ruby. instead of using numerous if-else statements check value of player's hand, decided following: #calculate players score def score poss.map {|check| if (check[1].call()) @score = check[0] puts @score return check[0] else false end } end poss = [ [10, :royal_flush?], [9, :straight_flush?], [8, :four_kind?], [7, :full_house?], [6, :flush?], [5, :straight?], [4, :three_kind?], [3, :two_pairs?], [2, :pair?] ] the second item in each item of 'poss' method created check whether player has hand. attempting call method .call(), following error: player.rb:43:in `block in score': undefined method `call' :royal_flush?:symbol (nomethoderror) player.rb:42:in `map' player.rb:42:in `score' player.rb:102:in `get_score' player.rb:242:in `<main>' http://ruby-doc.org/core-2.2.2/object.html objec...

android - create custom imageview - listview -

Image
i create below row listview each row has 2 imageviews , user can touch each of them (to open activity ). how can ? must create custom imageview ? thanks @fashizel @ how create layout that's split diagonally , 2 halves clickable? layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <framelayout android:layout_width="100dp" android:layout_height="100dp" android:id="@+id/framelayout"> <imageview android:layo...

Displaying validation errors in Laravel 5 with React.js and Ajax -

i running laravel 5 application has main view rendered using react.js. on page, have simple input form, handling ajax (sending input without page refresh). validate input data in usercontroller. display error messages (if input not pass validation) in view. i validation errors appear based on state (submitted or not submitted) within react.js code. how using react.js , without page refresh? here code: react.js code: var reactcsstransitiongroup = react.addons.csstransitiongroup; var signupform = react.createclass({ getinitialstate: function() { return {email: '', submitted: false, error: false}; }, _updateinputvalue(e) { this.setstate({email: e.target.value}); }, render: function() { var text = this.state.submitted ? 'thank you! expect follow @ '+email+' soon!' : 'enter email request access:'; var style = this.state.submitted ? {"backgroundcolor": "rgba(26, 188, 156, 0.4)"} : {}; retu...

javascript - js files are loading in unreadable format -

Image
i working on web app. used "✗" utf-8 character delete button. eclipse asked me save file in utf-8 format told yes. worked fine. next day when ran app again throwing exception "uncaught syntaxerror: unexpected token illegal" . when checked it, javascript file loading in unreadable format. see image below. i tried replace character unicode "&#10007;" , saved js files in default encoding, didn't help. do know why happening? it sounds saved in different text format loaded and/or loaded in different text format saved it. without recommending tool, see if can use change code-page/text-format , try stuff. however, seeing showing on teh screen 3rd part stuff, more re-download got first time, or perhaps unpack if saved installer/zip-file.

python - ('a' in 'abc' == True) evaluates to False -

this question has answer here: why expression 0 < 0 == 0 return false in python? 9 answers this got while fiddling python interpreter [mohamed@localhost ~]$ python python 2.7.5 (default, apr 10 2015, 08:09:14) [gcc 4.8.3 20140911 (red hat 4.8.3-7)] on linux2 type "help", "copyright", "credits" or "license" more information. >>> 'a' in 'abc' true >>> 'a' in 'abc' == true false >>> 'a' in 'abc' == false false >>> ('a' in 'abc') == true true >>> ('a' in 'abc') == false false >>> ('a' in 'abc' == true) or ('a' in 'abc' == false) false >>> (('a' in 'abc') == true) or (('a' in 'abc') == false) true my question why using...

ios - error: module 'Fabric' was built in directory '/Fabric.framework' but now resides in directory './Fabric.framework' -

since updated project xcode7beta3, there permanent error when try print whatever on console: error: module 'fabric' built in directory '/fabric.framework' resides in directory './fabric.framework' how fix issue? you should move fabric framework subfolder (maybe crashlytics framework too) , update run script accordingly: ./frameworks/fabric.framework/run .....

php - Combine the aoData array from DataTables with the serliazed form -

i using jquery data table , want combine aodata form serialize data using jquery. fnserverdata: function(ssource, aodata, fncallback,osettings) { aodata.concat( $("#frm").serializearray()); console.log(aodata); $.ajax( { "datatype": 'json', "type": "post", "url": 'ssource', "data": aodata, "success": fncallback } ); } but doesn't combine , return data table's array response. can please me out how can ? thanks table_obj = $('#group-table').datatable({ "sajaxsource": "url goes here", ...

wpf - Animation in expression blend VS2013 -

i have 4 balls animating. want animate 4 balls randomly within time limit, 1 minute. should create 4 storyboards (1 each ball)? since want balls independent of each other. how can call storyboards randomly then? this xaml: `<usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" x:class="ff2d.level1" x:name="usercontrol" d:designwidth="718" d:designheight="400"> <usercontrol.resources> <storyboard x:key="targetanimate"> <doubleanimationusingkeyframes storyboard.targetproperty="(uielement.rendertransform).(transformgroup.children)[3].(translatetransform.x)" storyboard.targetname="ellipse1"> ...

r - geocode result different from google maps -

Image
i'm trying geocode different iata airport codes in italy, following (rudimentary) code in ggmap (version 2.4) #list of iata codes geo_apt <- c("aoi", "bgy", "blq", "bri", "cta", "fco", "lin", "mxp", "nap", "pmf", "psa", "psr", "rmi", "trn", "vce", "vrn") #preparing empty dataframe store geocodes apt_geo <- data.frame(iata=rep(na,16), lon=rep(na,16), lat=rep(na,16)) #geocoding codes (i in seq_along(geo_apt)) { apt_geo[i,1] <- geo_apt[i] apt_geo[i,2] <- (geocode(paste(geo_apt[i],"airport")))[1] apt_geo[i,3] <- (geocode(paste(geo_apt[i],"airport")))[2] } and geocode function of ggmap works fine of these codes except "psr" iata lon lat 1 aoi 13.363752 43.61654 2 bgy 9.703631 45.66957 3 blq 11.287859 44.53452 4 bri 16.765202 41.13751 5 ...

r - Linear regression fails in Python with large values in dependent variables -

i'm trying rewrite forecasting model (in stata) using python (with pandas.stats.api.ols), , ran issue linear regression: coefficients , intercept computed pandas not match stata. investigation shows root cause might values of dependent values big. i've suspicion based on findings below: 1) created simple dataframe in python , ran linear regression it: from pandas.stats.api import ols import pandas pd df = pd.dataframe({"a": [10,20,30,40,50,21], "b": [20, 30, 10, 40, 50,98], "c": [32, 234, 23, 23, 31,21], "d":[12,28,12,98,51,87], "e": [1,8,12,9,12,91]}) ols(y=df['a'], x=df[['b','c', 'd', 'e']]) and summary lr is: -------------------------summary of regression analysis------------------------- formula: y ~ <b> + <c> + <d> + <e> + <intercept> number of observations: 6 number of degrees of freedom: 5 r-squared: 0.4627 adj r-squa...

C# | The process cannot access the file because it is being used by another process, even after closing Binary writer and reader -

i started learning c# about, 3 days ago, , had knowledge of java before. i've been working on program in these 3 days, hang of c#, , can learn, , that. in program, it's change few bytes in file, that's not point of this. point is, got of work, , loading bytes , writing bytes file works perfectly, except when.. after close program after changing bytes, , open again, can load them, when try save, error. process cannot access file '(the file)' because being used process. i absolutely positive it's not being used else, because things have opened opera, visual studio, , program, being debugged. if helps, here important parts (i know, code sucks, i'm new..): reading/displaying: choose = names.items.indexof(names.selecteditem); binaryreader br = new binaryreader(file.openread(ofd.filename)); br.basestream.seek(basestats + (28 * choose), seekorigin.begin); hptb.text = br.readbytes(1)[0].tostring(); br.basestream.seek(basestats + (28 * choose) + 1, seek...

php - limit column in database with UPDATE -

i have turns col. updated every half hour , add 5 turns every user on website. i want make limit, example 300, , every user has 295 or more updated 300, no more or less. this query right now: update `user_d` set turns=turns+5 id='".$id."' if i'll add "where turns < 300" users has 298 example jump 303 (over limit), how can limited 300? thx! english isn't strong , tryied make understandable, please ask me try , explain better if don't understood meant. use sql case, turns below 296 limit 300 update `user_d` set turns ( case when ((turns) < 296) turns=turns+5 else (turns) end ) id='".$id."'

security - Execute host commands from within a docker container -

i'm looking way user able execute limited set of commands on host, while accessing containers/browser. goal prevent need ssh'ing host run commands make start , make stop , etc. these make commands execute series of docker-compose commands , needed in dev. the 2 possible ways in can think of are: via cloud9 terminal inside browser (we'll using it). default terminal accesses container of course. via custom mini webapp (e.g. node.js/express) buttons map commands. easy if running on host itself, want keep code containers. although might not best practice still possible control host inside container. if running docker-compose commands can bind mount docker socket using -v /var/run/docker.sock:/var/run/docker.sock on ubuntu. if want use other system tools have bind mount required volumes using -v gets tricky , tedious when want use system bins use /lib.*.so files. if need use sudo commands don't forget add --privileged flag when running container...

space in json response not converting to php object -

below working code when trying echo "telecom circle", getting error "parse error: syntax error, unexpected 'circle' (t_string)". if ($_get['result']): $rslt = $_get['result']; $result = unirest\request::get("https://sphirelabs-mobile-number-portability-india-operator-v1.p.mashape.com/index.php?number=$rslt", array( "x-mashape-key" => "xxxxxxxxxxxxx", "accept" => "application/json" ) ); echo ($result->body->operator); echo($result->body->telecom circle); endif; api response : { "telecom circle": "delhi ncr", "operator": "vodafone", "is mnp": "false" } your code should : just used $result->body->{'telecom circle'} instead of $result->body->telecom circle if ($_get['result']): $rslt = $_get['result']; $result = unirest\request::get("https://sphirelabs-...

java - Line chart symbols clipped by axis when they lie on the axis -

Image
i have line chart defined axis range, , plotting points part of line lie on axis. default points , line segments lie on axis clipped, shown in below screen shot; my code below; package com.jtech; import javafx.application.application; import javafx.event.eventhandler; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.chart.axis; import javafx.scene.chart.linechart; import javafx.scene.chart.numberaxis; import javafx.scene.chart.xychart; import javafx.scene.input.mouseevent; import javafx.stage.stage; public class showsymbol extends application { @override public void start(stage stage) { final numberaxis xaxis = new numberaxis(0,4,1); final numberaxis yaxis = new numberaxis(0,10,2); final linechart<number, number> linechart = new linechart<>(xaxis, yaxis); xychart.series series = new xychart.series(); final xychart.data d1 = new xychart.data(0.0, 0.0); final xychart.data d2 = new xychart.d...

xml - XSLT: flatten tree -

i'd convert kodi-compatible xml xtreamer-compatible xml. input looks this: <?xml version="1.0" encoding="utf-8"?> <movie xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <id>something</id> <title>something</title> <originaltitle>something</originaltitle> ...and on... several unknown nodes <actor> <name>name1</name> <role>role1</role> <order>0</order> </actor> <actor> <name>name2</name> <role>role2</role> <order>1</order> </actor> <actor> <name>name3</name> <role>role3</role> <order>2</order> </actor> ...several other unknown nodes... </movie> what i'd have is: <?xml version="1.0" encoding="utf-8"?> <mov...

javascript - I am trying to create a button that changes its icon and color when clicked in angularjs -

i using font awesome icons , want change button icon , color when clicked have written directive directive('uitoggleclass', ['$timeout', '$document', function($timeout, $document) { return { restrict: 'ac', link: function(scope, el, attr) { el.on('click', function(e) { e.preventdefault(); var classes = attr.uitoggleclass.split(','), targets = (attr.target && attr.target.split(',')) || array(el), key = 0; angular.foreach(classes, function( _class ) { var target = targets[(targets.length && key)]; ( _class.indexof( '*' ) !== -1 ) && magic(_class, target); $( target ).toggleclass(_class); key ++; }); $(el).toggleclass('active'); function magic(_class, target){ var patt = new regexp( '\\s' + ...