Posts

Showing posts from January, 2013

ruby on rails 3 - Can't mass-assign protected attributes for Nested simple_form -

i have form nests store fields within seller fields. this = simple_form_for @seller, url: pages_path |f| .span3 h5.capital personal/contact details = f.input :name, label: false, placeholder: 'full name (owner/manager)' = f.input :mobile, label: false, placeholder: 'mobile phone no.' = f.input :landline, label: false, placeholder: 'landline no. (with std code)' = f.input :email, label: false, placeholder: 'email id' .span5 h5.capital store details = f.simple_fields_for :store_attributes |builder| = builder.input :name, label: false, placeholder: 'store name' = builder.input :address, label: false, placeholder: 'full address' = builder.input :city, label: false, placeholder: 'city/district', = builder.input :pincode, label: false, placeholder: 'pincode', class: 'pincode' = builder.input :website, label: false, placeholder: 'website/facebook pag

html - bootstrap 3 jumbotron under bs-header -

i'm updating site bootstrap 3 , have problem have added navbar , header when try add jumbotron appears under bs-header dono why check every thing if div closed , sow if 1 can tel me i'm doing wrong ? <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content="hypergainz"> <title> mod pack &middot; mmp </title> <!-- bootstrap core css --> <link href="assets/css/bootstrap-simplex.css" rel="stylesheet"> <link href="assets/css/bootstrap-simplex.min.css" rel="stylesheet"> <!-- documentation extras --> <link href="assets/css/docs-index.css" rel="stylesheet"> <link hre

java - Sorting Arraylist for a string but only by date -

i have arraylist contains "2013-7-13 \n 12 hour(s) 23 minute(s) " such kind of records. how can sort date. piece of code: string date1 = c.getstring(c.getcolumnindex(tabprodb.key_date) ); string time1 = c.getstring(c.getcolumnindex(tabprodb.key_time) ); string date_time1 = date1 + "\n" +time1; toast.maketext(history.this, date_time1, toast.length_short).show(); listitems.add(date_time1); create own comparator<string> implementation, following: note there no error checks, it's show how it. public static void main(string[] args) { list<string> strings = arrays.aslist("2013-7-13 \n 12 hour(s) 23 minute(s)", "2013-7-10 \n 12 hour(s) 23 minute(s)"); collections.sort(strings, new comparator<string>() { @override public int compare(string o1, string o2) { simpledateformat format = new simpledateformat("yyyy-mm-dd"); date date1; da

wpf textbox custom control type error -

i wrote custom control base on textbox has minimum , maximum inputs follows: public class numerictextbox : textbox { static numerictextbox() { defaultstylekeyproperty.overridemetadata(typeof(numerictextbox), new frameworkpropertymetadata(typeof(numerictextbox))); } public static readonly dependencyproperty minimumproperty = dependencyproperty.register("minimum", typeof(int), typeof(numerictextbox), new propertymetadata(default(int))); public int minimum { { return (int)getvalue(minimumproperty); } set { setvalue(minimumproperty, value); } } public static readonly dependencyproperty maximumproperty = dependencyproperty.register("maximum", typeof(int), typeof(numerictextbox), new propertymetadata(100)); public int maximum { { return (int)getvalue(maximumproperty); } set { setvalue(maximum

python - Uploading multiple files in Tornado -

i new tornado , trying make simple multiple file upload form, users able upload either 1 or more files. here relevant part in upload.py class uploadhandler(tornado.web.requesthandler): def get(self): files_dict = {} self.render("upload_form.html", files_dict = files_dict) def post(self): ofn="" #original file name ufn="" #uploaded file name files_dict = {} # dict of original:uploaded names #file1 if self.request.files['file1'][0]: file1 = self.request.files['file1'][0] #infput file ofn = file1['filename'] extension = os.path.splitext(ofn)[1] if extension in ext: fname = ''.join(random.choice(string.ascii_lowercase + string.digits) x in range(8)) ufn= fname+extension output_file = open("uploads/" + ufn, 'w'

javascript - Backbone groupedBy collection is rendered only after one event click -

i have problem groupedby collections because not rendered after second event click. think there problem fetch collection...but don't know how fix. there code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>backbone test</title> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> ul.items{list-style: none;width: 100%;margin: 0px;-webkit-margin-before: 0em;-webkit-padding-start: 0px;} </style> </head> <body> <header> </header> <content id="content"> <div id="persons"></div> <div id="items"></div> <div id="orders"></div> </content> <footer&g

javascript - ThreeJS Voxel not fixed to grid -

Image
i using voxel painter example threejs git repo. i have changed voxels bigger example. instead of taking 1 grid space on x coordinate, take 2. however doing means roll on mesh isn't fixed grid , instead goes on half of 1 on 1 side, , half of 1 on other side. here code: // in example geometry set (50, 50, 50) self.rollovergeo = new three.cubegeometry(100, 50, 50); self.rollovermaterial = new three.meshbasicmaterial({ color: 0xff0000, opacity: 0.5, transparent: true }); self.rollovermesh = new three.mesh(self.rollovergeo, self.rollovermaterial); self.rollovermesh.position = new three.vector3(0, 25, 0); does know why is? the geometry centered @ origin in local coordinate system. need translate geometry so: rollovergeo = new three.cubegeometry( 100, 50, 50 ); rollovergeo.applymatrix( new three.matrix4().maketranslation( 25, 0, 0 ) ); cubegeo = new three.cubegeometry( 100, 50, 50 ); cubegeo.applymatrix( new three.matrix4().maketranslation( 25,

mysql - effective query on a table with over 1 million record -

i struggling following 2 queries. have 2 tables both on million records. first query runs 30 seconds , second 1 runs on 7 mins. basically count class.id , scan_layers.id based on lot. effective way it? select count(class.id), count(scan_layers.id), lot, verified class left join scan_layers on (class.scanlayer = scan_layers.id) group lot; select count(class.id), count(distinct scan_layers.id), lot, verified class left join scan_layers on (class.scanlayer = scan_layers.id) group lot; as explain it, both giving me same explain. +----+-------------+--------------------+--------+---------------+------------------------+---------+----------------------------------+---------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+-------------+--------------------+--------+---------------

javascript - JS Replace String starting with space and ending with space or comma or dot with another string -

i know basic javascript regex. confused lookheads. title says, want replace word word if ends space , dot(.) or comma(,) eg: replacing "his" "her" in following text "xyz his, his." to "xyz her, her." input.replace(/\b([hh])is(?=[., ])/g, '$1er') lookahead 0 width assertion check not match input.. with above regex matching his followed [., ] .. \b word boundary let match individual words..

android - Open DrawerLayout, perform action, then close it -

so want animate drawerlayout in such way opened, item added menu in it, closed. i tried great deal of things, problem there no delay between "open" , "close" commands (or @ least not noticeable one) , animation never triggers. i don't want use 'post delayed' arbitrary length because seems dirty. i've tried manually overriding "ondraweropened()" in listener - worked, can't close after action performed because can't close within (meaning, if 'closedrawer(layout)' method invoked sub-thread of listener itself, it'll runtime error). so have is: _drawertoggle = new actionbardrawertoggle(mainactivity.this, _drawerlayout, r.drawable.ic_drawer, r.string.draweropen, r.string.drawerclose) { /** called when drawer has settled in closed state. */ public void ondrawerclosed(view view) { getactionbar().settitle(_title); } /** called when drawer has settled in open state. */ publi

java - Why am I being asked for a return type when creating a constructor? -

i'm trying make class , create 2 constructors in it. i've created have done of previous classes , constructors, reason keeps telling me add return type 2 constructors. i've tried see if i've created different previous constructors can't see difference. can see i'm going wrong here? public class book { //instance variables //accessspec type varname; private string title; private string author; private double price; //constructors public initialiseinstancefields() { title = ""; author = ""; price = 0.00; } public initialiseinstancefields(string titlein, string authorin, double pricein) { title = titlein; author = authorin; price = pricein; } //methods //accessspec returntype varname(arglist){} //return title public string gettitle() { return title; } }//end class constructors must have same name class name

How do i tint an image with HTML5 Canvas? -

my question is, best way tint image drawn using drawimage method. target useage advanced 2d particle-effects (game development) particles change colors on time etc. not asking how tint whole canvas, current image draw. i have concluded globalalpha parameter affects current image drawn. //works drawimage() canvas2d.globalalpha = 0.5; but how tint each image arbitrary color value ? awesome if there kind of globalfillstyle or globalcolor or kind of thing... edit: here screenshot of application working with: http://twitpic.com/1j2aeg/full alt text http://web20.twitpic.com/img/92485672-1d59e2f85d099210d4dafb5211bf770f.4bd804ef-scaled.png you have compositing operations, , 1 of them destination-atop. if composite image onto solid color 'context.globalcompositeoperation = "destination-atop"', have alpha of foreground image, , color of background image. used make tinted copy of image, , drew tinted copy on top of original @ opacity equal amount want ti

documentation generation - How to use valadoc? -

i writing library in vala. i have come point generate documentation sources. valadoc seems right tool this, there not information on how use it, manpage short. i tried run valadoc -o doc src/*.{vala,vapi} gives me these error messages: unixodbc.vala:21.7-21.9: error: namespace name `gee' not found unixodbc.vala:40.9-40.27: error: type name `map' not found unixodbc.vala:42.30-42.48: error: type name `map' not found unixodbc.vala:40.9-40.27: error: type name `map' not found unixodbc.vala:40.9-40.27: error: type name `map' not found unixodbc.vala:40.9-40.27: error: type name `map' not found unixodbc.vala:80.63-80.81: error: type name `map' not found unixodbc.vala:98.9-98.25: error: type name `arraylist' not found unixodbc.vala:99.3-99.19: error: type name `arraylist' not found unixodbc.vala:110.4-110.22: error: type name `map' not found unixodbc.vala:178.9-178.24: error: type name `arraylist' not found unixodbc.vala:180.17-180.32:

extjs - modal panel in sencha doesnt show up on click -

i want display modal info window clicking button in toolbar. dont know why, nothing happens when click button. heres code: xtype: 'toolbar', docked: 'bottom', items: [ { xtype: 'button', text: 'infos anzeigen', handler: function(){ var panel = new ext.panel({ modal: true, left: 0, top: 0, width: 220, height: 356, layout: 'fit', html: 'testing' }); panel.show(); } }] you're looking ext.window : var win = new ext.window({ modal: true, left: 0, top: 0, width: 220, height: 356, layout: 'fit', html: 'testing' }); win.show();

javascript - Effective ways how to get data from the server -

building webapp , have troubles deciding how data server. on frontend have angularjs , html. on backend have nodejs, mongodb, mongoose , express. templating engine user jade. now, best way fill templates? getting data on server while loading partial or load data through angularjs using $http? looking effective , fastest way. thoughts? i'll suggest separate things bit. keep backend independent , create rest api provides data. once done may use http request access data. following approach later able use other frameworks or other languages information stored database.

python - How to use a library that imports memcache in App Engine -

i want use library (memorised) uses memcache this: import memcache now on app engine, memcache must imported this: from google.appengine.api import memcache so error when running dev_appserver.py: importerror: no module named memcache can use library without modifying it? the short answer is: if can module work on local instance using dev_appserver.py , because google controls server environment, can use supported modules when upload code hosting services. see here. the long answer that, in order import memcache , need memcache package installed. if want try use memcache module google provides instead, can change from google.appengine.api import memcache , google's memcache may have substantial , significant differences standard python memcache package memorised uses, , may throw errors or not work @ all. furthermore, if memorised work, won't able use on google's servers, not supported third-party library (see above).

javascript - Collecting data from webpage with VBA -

i informations excel sheet webpage: http://www.livescore.in/ my code this: dim page1 msxml2.xmlhttp60 dim html mshtml.htmldocument dim mydiv object set page1 = new msxml2.xmlhttp60 set html = new mshtml.htmldocument page1.open "get", "http://www.livescore.in", false page1.send until page1.readystate = 4 , page1.status = 200 doevents loop html.body.innerhtml = page1.responsetext set mydiv = html.getelementbyid("fscon") debug.print mydiv.innertext i work in "fs" div in "fscon" div result of script "loading ..." i know problem: when base page loading javascript fill "fscon" div. script sees base page (without data mathces) my question how can wait until full page loading? thanks update: code working. uses ie object, test how fast scanning matches page. dim ieapp internetexplorer dim iedoc object set ieapp = new internetexplorer ieapp.visible = false ieapp.navigate "http://www.livescore.in&

symfony - How to get the id of all the materials? -

help me public function indexaction() { $tpos = $this->getdoctrine()->getrepository('testbundle:materials')->findall(); foreach($tposs $tpos) { $posts['id']; } echo $midcount; how you? notice: undefined index: id $materials = $this->getdoctrine()->getrepository('testbundle:materials')->findall(); $materialids = array(); foreach ($materials $material) { $materialids[] = $material->getid(); }

android - androidL how to reset a timer -

i learning use timer, , follow example in http://examples.javacodegeeks.com/android/core/os/handler/android-timer-example/ . i implement in way timer start off when user pressing button , stop when user's hand off, have coded follows: codes: button_right.setontouchlistener( new view.ontouchlistener() { @override public boolean ontouch(view arg0, motionevent event) { if(event.getaction()==motionevent.action_down ) { starttime = systemclock.uptimemillis(); customhandler.postdelayed(updatetimerthread, 0); if((event.getaction()==motionevent.action_up || event.getaction()==motionevent.action_cancel)) { timeswapbuff += timeinmilliseconds; customhandler.removecallbacks(updatetimerthread); } return false; } }); // setting timer private runnable updatetimerthread = new runnable() { public void run() { timeinmilliseconds = systemclock.uptimemil

c# - Why not have an array with a negative number as index? -

c# arrays, why not have array negative number index? situation useful; fast algorithm in special type of sorting. 2 questions: 1) why not? 2) efficient workaround? you can implement own class indexer . example: public class myclass { public string this[int index] { { // ... } set { // ... } } } where string return type example.

hadoop - HIVE delimiter \n ^M issue -

i have file columns delimited ^a , rows delimited '\n' new line character. i first uploaded hdfs , create table in hive using command this: create external table if not exists html_sample ( ts string, url string, html string) row format delimited fields terminated '\001' lines terminated '\n' location '/tmp/directoryname/'; however, when select statement table. turned out mess. the table looks this: ts url html 10082013 http://url.com/01 <doctype>.....style="padding-top: 10px; text-align... null null text-align... null null text-align... null null 10092013 http://url.com/02 <doctype>.....style="padding-top: 10px; text-align... null null text-align... null null text-align... null null then went text file , found there exist severa

java - Does init support apps with Selenium Jars? -

is possible embed java app has selenium code lines web browser? supported or not? i have java application uses selenium api. tried use init() method embed gui window browser application launched website, did not work. supposed way? technically can because selenium java client java app interacts selenium grid in jsonwire protocol. take @ question run selenium webdrivers applet in html

php - execute a function just once for all users -

i'm building on-line multi-player board game , have function creates new board. need after every round, can't seem able make execute once users. call function when timer reaches 0, on page game situated, executes every user on page. thus, function generates new board many times there users playing game @ moment, want generate 1 board. so, question how can make php function execute once , not many times there pages open? edit on system: users play 90 seconds wait 15 second while see round results , whole thing repeats again , again. , if enter page in middle of round have option wait until new round begins or enter round right then. have no idea call function. tried calling when pause menu begins results displayed, executes function users.it still works cause still 1 board @ end of executions, it's not right, if there more hundreds of people playing, board generated hundreds of time. , also, generates board c++ .exe creates xml on server.i execute exe php , additio

php - readdir() reads nonexistent files "." and ".." -

i'm basic php programmer, simple website users , profile pictures. there folder called ppic (profile pictures). when use readdir() says on php.net site , prints out 2 nonexistent files. if put echo "there match - $entry<br>; inside while loop $entry being file name, prints out: there match - . there match - .. there match - autumn leaves.jpg there match - creek.jpg there match - toco toucan.jpg i have 3 files in folder: "autumn leaves.jpg", "creek.jpg", , "toco toucan.jpg". i'm not great computers, have no idea dots mean. can please explain these me? learn unix basics: (and other common filesystem handlings) the . virtual symbolic link current folder (e.g. ./creek.jpg is, resolved, same creek.jpg ) the .. virtual symbolic link parent folder. to hide them, manually exclude via $file !== '.' && $file !== '..' .

c# - How to do Searching and Filtering Data based on Checkboxes in Many to Many Relationship in SQL? -

Image
basically have 3 tables (with many many relationship); , querying searching this; alter proc [dbo].[usp_contactsearch] ( @personname varchar(60)= '', @mobileno varchar(20)= '', @nationlity varchar(50)='' , @contacttypes varchar(max) = '' ) begin select distinct c.contactid, c.personname, ct.contacttype, ct.contacttypeid contact c left outer join contactwithcontacttype cct on c.contactid = cct.contactid left outer join contacttype ct on cct.countacttypeid = ct.contacttypeid c.personname case when @personname='' c.personname else '%'+@personname+'%' end , c.mobileno1 case when @mobileno='' c.mobileno1 else '%'+@mobileno+'%' end , c.nationality case when @nationlity='' c.nationality else '%'+@nationlity+'%' end end so, result data default is; so, front end, have contacttypes (which dynamic i.e comming contact

php - Cakephp hidden input field -

so have field want keep hidden in form. for purpose have tried following: <?php echo $this->form->input('group_id', array('hiddenfield' => true, 'value'=> 2)); ?> i tried: <?php echo $this->form->input('group_id', array('options' => array('hiddenfield'=> 'true'), 'value'=>2 )); ?> how ever still see input field.. what doing wrong? you misread documentation, assume. hiddenfield enable/disable specific hidden fields specific form fields. you either looking for $this->form->hidden('group_id') or $this->form->input('group_id', ['type' => 'hidden']); i use latter. see http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html but - said - shouldnt use either 1 of those. , omit fields serve no real purpose view , form. instead should inject fields data array prior saving. see http://www.dereuromark.d

c - What happens when you calloc a struct containing an enum type? -

typedef enum { false, true }bool; struct { bool value_set; int value; } what happens when struct allocated using calloc? enum hold false default value? since calloc sets memory 0. an enum integral type. if don't assign them values, start @ 0 , increase. therefore typedef equivalent typedef enum { false = 0; true = 1; } bool; therefore calloc set value_set 0 equal false .

android - XML:JAXB Mapping Java Objects and XML Document -

i'm trying implement java classes handling following xml code snippet: <party date="2012-09-30"> <guest name="albert"> <drink>wine</drink> </guest> </party> i've wrote 3 classes: party.java: package li.mnet.www.java.xml; import javax.xml.bind.annotation.xmlaccesstype; import javax.xml.bind.annotation.xmlaccessortype; import javax.xml.bind.annotation.xmlattribute; import javax.xml.bind.annotation.xmlrootelement; @xmlaccessortype(xmlaccesstype.field) @xmlrootelement(name = "party") public class party { @xmlattribute(name = "date") private string partydate; public party() {} public string getpartydate() {return partydate;} public void setpartydate(string partydate) { this.partydate = partydate; } } guest.java: package li.mnet.www.java.xml; import javax.xml.bind.annotation.xmlelement; public class guests { private string name; pu

Is there a dedicated milli-sec precision timestamp data structure in python pandas? -

for instance, in q, there dedicated time struct, such 11:59:59.999, can use in table column. there in pandas? i read doc , there seems quite comprehensive examples timestamp on daily resolution, fund managers, guess. there milli-second resolution time struct? yes there is! it's called timestamp ! pandas has support nanosecond resolution using own timestamp class subclass of datetime.datetime : in [6]: pd.timestamp('now') + np.timedelta64(100, 'ns') out[6]: timestamp('2013-10-06 21:09:19.000000100', tz=none) in [7]: isinstance(_6, datetime.datetime) out[7]: true note date-like series objects represented datetime64[ns] : in [8]: series(date_range('now', periods=5)) out[8]: 0 2013-10-06 21:11:37 1 2013-10-07 21:11:37 2 2013-10-08 21:11:37 3 2013-10-09 21:11:37 4 2013-10-10 21:11:37 dtype: datetime64[ns] this true if specify 'd' (day) frequency on construction: in [11]: series(date_range('1/1/2001&

c# - Unable to cast List<int[*]> to List<int[]> instantiated with reflection -

Image
i instantiating list<t> of single dimensional int32 arrays reflection. when instantiate list using: type typeint = typeof(system.int32); type typeintarray = typeint.makearraytype(1); type typelistgeneric = typeof(system.collections.generic.list<>); type typelist = typelistgeneric.makegenerictype(new type[] { typeintarray, }); object instance = typelist.getconstructor(type.emptytypes).invoke(null); i see strange behavior on list itself: if interface through reflection seems behave normally, if try cast actual type: list<int[]> list = (list<int[]>)instance; i exception: unable cast object of type 'system.collections.generic.list`1[system.int32[*]]' type 'system.collections.generic.list`1[system.int32[]]'. any ideas may causing or how resolve it? working in visual studio 2010 express on .net 4.0. the problem caused makearraytype function. way you're using create multidimensional array 1 dimension, not same 1

java - OptaPlanner CVRPTW - continuous deliveries -

i'm new optaplanner, , i'm trying configure in project solve cvrptw problem. current configuration similar example can find in source code of project, requirements different. application receives continuously delivery requests where: average service duration 5 minutes duetime - readytime = 10 minutes average distance (in time) between locations 2,5 minutes only 1 depot my idea re-run solving algorithm every time new request received. necessary me understand if request feasible or if needs shifted forward or backward in time. if consider following problem statement (locations omitted, equidistant depot's location): cust_id ready_time due_time serv_dur demand 1 12:45:00 12:55:00 00:05:00 1 2 12:35:00 12:45:00 00:05:00 8 3 12:25:00 12:35:00 00:05:00 5 4 13:25:00 13:35:00 00:05:00 5 considering there 2 vehicles available, both capacity of 10, followi

ios - Why can't I change the number of elements / buses in the input scope of AU multi channel mixer? -

update: i'm changing code illustrate issue in more streamlined way. had little bug which, while not deterring problem, did add confusion. i'm instantiating multi channel mixer au in ios (kaudiounitsubtype_multichannelmixer) , following: osstatus status = noerr; // set component type: audiocomponentdescription cd = {0}; cd.componenttype = kaudiounittype_mixer; cd.componentsubtype = kaudiounitsubtype_multichannelmixer; cd.componentmanufacturer = kaudiounitmanufacturer_apple; // alloc unit: audiocomponent defaultoutput = audiocomponentfindnext(null, &cd); audiounit mixer; status = audiocomponentinstancenew(defaultoutput, &mixer); nslog(@"au init status: %li", status); // can try initializing unit before or after attempt set input bus count. // doesn't matter; won't work either way. audiounitinitialize(mixer); // number of inputs uint32 bussize = sizeof(uint32); uint32 buscount = 0; status = audiounitgetproperty(mixer,

python syntax error invalid syntax -

Image
i'm new python programing language. purchased book , i've been reading it. book called (3x) python programming absolute beginner third edition. i'm trying put i've far learned action. have problem don't understand know it's simple i'm not sure how solve if can tell me problem , how correct it. appreciate in advance! :) add more tried doing python 2x , had same message error syntax, invalid syntax. whitespace used denote level of indention in python. the else: needs aligned (have same indentation level) if jim_age ... . if jim_age > sam_age: print("jim older") else: print("sam older")

ruby - Nested forms in Devise (Rails 3.2) - Not saving -

i have setup app using devise gem login (user model). within sign view, ive included simple_fields_for form includes attributes student model. everything displays correctly in view, when submit button clicked nested record not created. user model class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # setup accessible (or protected) attributes model attr_accessible :email, :password, :password_confirmation, :remember_me, :role, :student_attributes # attr_accessible :title, :body has_one :student, :inverse_of => :user, :autosave => true accepts_nested_attributes_for :student end student model class student < activerecord::base attr_accessible :course, :email, :fname, :lname, :student_num, :university, :year set_primary_key :student_num belongs_to :user,

twitter bootstrap - Positioning three divs: one left and two smaller stacked on the right -

i'm using bootstrap , wanna have 1 big div on left side of website , 2 smaller divs on right side. smaller divs should under each other. whole constructure shall rectangle. sorry bad english hope able understand me use containing div hold 2 right divs , float both divs left. psuedo-selector "after" on .right-wrap clear floats semantically without need code. code: <div class="left">fu</div> <div class="right-wrap"> <div class="rtop">blah</div> <div class="rbottom">blah again</div> </div> css: .left { width: 100px; height: 200px; background:red; float:left; cleat:left; } .right-wrap { width: 100px; height: 200px; float:left; } .right-wrap:after { content: ""; clear:both; } .rtop { position: relative; width: 100px; height: 100px; background:blue; } .rbottom { position: relative; width: 100px; height: 100px; background:yellow; }

compilation - Creating a Vala Sublime Text build system -

i can't seem make vala build system in sublime text 2... here's have far: { "cmd": ["valac", "--pkg", "gtk+-3.0", "'$file'"] } unfortunately, compiles code valac, doesn't run it. how can make run compiled program straight after? use vala instead of valac . however, keep in mind not keep resulting executable. need chain multiple command together—i don't know how sublime text, on command line like valac -o foo --pkg gtk+-3.0 file.vala && ./foo

javascript - How can I write this function on mouse hover a div? -

how can write function when mouse resting on div .resting trigger call. here code: $(document).bind('mousemove', function() { resetactive() }); i want call resetactive when mouse resting on desired div .resting. how can write code? $('.resting').mouseenter(resetactive); or, clean , better practice, $('.resting').on('mouseenter', resetactive); // , later $('.resting').off('mouseenter', resetactive); and event: var resetactive = function(e) { // something... }

Python - regex to complete hyphens in standard filename format -

this program goes through directory , fixes (if possible) filenames specific format of whitespaces, hyphens, etc. method regexsubfixgrouping() changes improper whitespace found in filenames proper whitespace. method checkproper() shows format needed. proper format: 201308 - (82608) - mac 2233-007-methods of calculus - klingler, lee.pdf everything works pretty except regex should insert of first 4 hyphens may missing. i'm not overly concerned hyphens @ point, maybe down road. mainly, want insert of first 4 missing hyphens (and maintain it's current functionality of correcting whitespace, etc). methods: def readdir(path1): return [ f f in os.listdir(path1) if os.path.isfile(os.path.join(path1,f)) ] def checkproper(f,term): return re.match(term + '\s-\s\(\d{5}\)\s-\s\w{3}\s\d{4}\w?-\d{3}-[^\.]+\s-\s[^\.]+\.txt', f) def regexsubfixgrouping(f,term): """ improved version of regexsubfix(). corrects improper whitespace in filena

json - Return ordered dictionary to django template -

Image
suppose want display posts in disqus. (it seems can comment on post in depth) how pass such data django template , let draw data disqus? e.g. want display posts belong thread in way reveals parent-child relationship. how can in django? (python/json/..) have looked using django-mptt ? have found works quite type of tree structure.

java - Hashtag Uniqueness -

i trying find unique hashtags tweet user inputs. brother helping me, had leave. anyway, have code find number of times word used in input, need know number of different hashtags used. example, in input "#one #two blue red #one #green four", there 3 unique hashtags #one, #two, , #green. cannot figure out how code this. import java.util.arraylist; import java.util.arrays; import java.util.scanner; public class tweet { public static void main(string[] args) { scanner hashtag = new scanner( system.in ); system.out.println( "please enter line of text" ); string userinput = hashtag.nextline(); userinput = userinput.tolowercase(); userinput = userinput.replaceall( "\\w", " " ); // strip out non words. userinput = userinput.replaceall( " ", " " ); // strip out double spaces // created stripping out non words /