Posts

Showing posts from January, 2013

ajax - Rails js action won't run code after partial render -

i'm trying add newly created partial existing list of partials gets rendered in create.js.erb controller action response, , nice scroll item , indicate new addition highlighting or something. have gotten hang of scrolling part in client side javascript, effects come after partial render in create.js.erb don't run. there plenty of examples of being possible, i'm not sure why mine doesn't work. first try: create.js.erb $('#alltab').removeclass('active'); $('#activetab').addclass('active'); $('#completetab').removeclass('active'); // todo: make sure li below gets id="campaign_####" before render happens. $('#activetablist').append("<li><%= escape_javascript(render partial: 'fundraisers/fundraiser', locals: {f: @fundraiser, g: @group}) %></li>") var number_li = $('#activetablist li').length; var $newcampaigndiv = $('#activetablist li').last().chi

c# - MongoDb Query doesn't return all of the time -

i have simple query running against mongo using official c# driver 1.8 returns performing query 50% of time. have unit test , if run query return 50% of time in less second other times never finish. below query var q = database.getcollection<stuff>("stuff").asqueryable() .where(x => x.partition == partitionname && x.persistantid != null && ( (x.when.datestart > startingfrom && x.when.dateend == null) || (x.when.dateend > startingfrom))); return q.tolist(); when take query , run in mongovue using query below can response in under 1 second. { "partition" : "partitionid:53", "persistantid" : { "$ne" : null }, "$or" : [{ "when.datestart" : { "$gt" : isodate("2012-04-01t06:00:00z") }, "when.dateend" : null }, { "when.dateend" : { "$gt" : isodate("2012-04-01t06:00:00z") } }] } it seems perha

android - Publish progress from an external class during Async Task? -

i have async task doinbackground() method this: protected string doinbackground(string... params) { myclass session = new myclass("email", "password"); return session.isauthorized(); } while myclass , in completly different package, this: private class myclass { // fields, constructors, etc public boolean isauthorized() { // stuff log("action 1..."); // stuff log("action 2..."); // other stuff return result; } public static void log(string str) { // here publish progress in async task // but, until now, it's kinda like: system.out.println(str); }

precompiling - Separating header and source files after compiling .proto with Protocol Buffers -

i'm working on project structure similar following: root/inc/foo/bar/ root/src i've started use google protocol buffers , when compile code found need add foo/bar/file.h file.cc file in order code find header. don't plan commit .h , .cc files repo since automatically generated. there parameter can give protoc seperate header/source files different directories , add correct path source file #includes? maybe append script "mv foo.h foofolder/" after executing protoc

javascript - View only works the first time in Angular -

i have app , utilizing routes load 2 different views. the first route #/ main list view. works every time. my second route #/view/:id , loads second view when list item clicked. the view data driven based off id, of need make $http requests through service created. is possible when leave #/view/:id route, unloads view , reloads when come back? or how go resetting promises inside service next time view loaded, request new data? these not mutually exclusive questions. routing ngview destroys view, scope, , controller on every load, controller , scope history not preserved among routes. otherwise, memory load in browser high; instead, can use services preserve state need across routes. $http requests made fresh every time called, unless cache option enabled. there shouldn't work required work designed: .factory( 'dataservice', function( $http ) { return function dataservicefn ( id ) { return $http.get( '/myapi', { params: { i

awt - Mandelbrot set in java doesn't calculate correctly -

Image
i'm still relatively new java. i've been working on program display mandelbrot set. current code generates image close, not quite mandelbrot set. generation code: private void generatemap () { // scale, iterations, map, , size class variables // cr , ci actual coordinates in set being used double cr = -2*scale; double ci = -2*scale; // , b step through array used store drawing // , control when loop exits (int = 0; < size.width; a++) { (int b = 0; b < size.height; b++) { double xr = 0; double xi = 0; int iter = 0; while (iter < iterations) { xr = (xr*xr-xi*xi) + cr; xi = (2*xr*xi) + ci; if (xr*xr+xi*xi > 4) { map[a][b] = iter; iter = iterations; } iter++; } ci += increment*scale; } ci = -2*s

c# - SQL Server CE application with user permissions -

i'm trying develop application allows managing of users via winforms , sql server ce database. i've established way users login via login set in table database username , password columns. now, i'm trying figure out best way go limit access specific features of application. goal sort application modules (customers, employees, billing, etc.) , give user read write permissions entire module. later on might try implement security on per-form basis. any ideas on how accomplish this? first need create roles table on sql ce. so usertable might have roleid fk added in each user. let have admin , user role. in each of form, add security handler methods / class checks role of user access application. create public string role; , puclic string username in each of form can pass values rest of form. example on customer form load can add if(role=="admin") { //visible controls stuff } else { //user //set controls read stuff } on log

Change value of Word MailMerge field using VBA -

i have document mailmerge fields, not want use whole datasource->mailmerge idea. instead presenting userform on autonew() , asking user type data fields. the reason because document "merged" 1 row of data waste of time asking user whole data source thing 1 row. i have working solution using docvariables i'm sure people correct way it, client likes idea of "seeing" mailmerge variable (such <<1>>) in source document. know can use alt-f9 display codes see docvariables, insist on wanting use mergefields. using docvariables using following. works know have right idea , rest of code works fine. activedocument.variables("varsurame").value = .txtsurname however, cannot workout how same thing merge fields. want below (but there no "value" property set). activedocument.mailmerge.fields("surname").value = .txtsurname the .text property readonly cannot use that. the following renders "bookmark not defined

c++ - incomplete type is not allowed while trying to create an array of pointers -

i created 2 classes, branch , account , want branch class have array of account pointers, fail it. says "incomplete type not allowed". wrong code? #include <string> #include "account.h" using namespace std; class branch{ /*--------------------public variables--------------*/ public: branch(int id, string name); branch(branch &br); ~branch(); account* ownedaccounts[]; // error @ line string getname(); int getid(); int numberofbranches; /*--------------------public variables--------------*/ /*--------------------private variables--------------*/ private: int branchid; string branchname; /*--------------------private variables--------------*/ }; although can create array of pointers forward-declared classes, cannot create array unknown size. if want create array @ runtime, make pointer pointer (which of course allowed): account **o

Why the android awesomeplayer was made using struct not class -

Image
i found native layer of android uses class , struct. for example, mediaplayer , stagefrightplayer , audioplayer , metadata class. awesomeplayer , mediasource struct. although read class , struct similar in use, wonder why awesomeplayer created struct. there reason or developer's taste? you try mention awesomeplayer , mediasource android apis? no, aren't, converted structures c++; not belong android libraries! please see diagram of stagefright , lib c/c++ core. android linux core, , can bring c/c++ utils, libs it. reference: http://pierrchen.blogspot.sg/2012/03/share-with-you-what-have-learned-about.html

Any way to access transient cluster settings / state in an ElasticSearch plugin? -

i'd store simple state (key-value pairs) that's shared across elasticsearch cluster, plugin. (n.b. -- plugin not vehicle/method store state, want use such state in plugin.) i've tried doing via cluster update settings api, settings newsettings = immutablesettings.settingsbuilder() .put(my_setting, my_value).build(); client.admin().cluster().prepareupdatesettings() .settransientsettings(newsettings).execute().actionget(); but, unfortunately, won't work because my_setting not registered in indexdynamicsettingsmodule . can't figure out how hook module (possibly adddynamicsetting method). is there way store custom key-values in transient cluster settings ? (c.f. http api ). as alternatives , seems node state api can return custom values, more things 1 compute , return plugin, rather stored state. storing values in static variables, , distributing throughout cluster broadcast actions option, i'd prefer simple if exists. any solution needs reason

jquery - Unable to get the correct innerHTML after AJAX load -

i updating innerhtml of element through ajax succesfully... when want same innerhtml of element using .htm() , not updated innerhtml... it returns previous mark when document loaded..... how solve this..? instead of using html() try using inner html directly. i.e. instead of var youobj = $(".someselector"); var html = yourobj.html(); do: var youobj = $(".someselector"); var html = yourobj[0].innerhtml; although admittedly both should give same result.

cocos2d iphone - Chipmunk Physics Positioning -

i've looked around quite bit , haven't been able find concise answer question. cocos2d game have integrated chipmunk physics engine. on initialization, setup boundaries of 'playing field' establishing series of bodies , static shapes follows: - (void)initplayingfield { // physics parameters cgsize fieldsize = _model.fieldsize; cgfloat radius = 2.0; cgfloat elasticity = 0.3; cgfloat friction = 1.0; // bottom cgpoint lowerleft = ccp(0, 0); cgpoint lowerright = ccp(fieldsize.width, 0); [self addstaticbodytospace:lowerleft finish:lowerright radius:radius elasticity:elasticity friction:friction]; // left cgpoint topleft = ccp(0, fieldsize.height); [self addstaticbodytospace:lowerleft finish:topleft radius:radius elasticity:elasticity friction:friction]; // right cgpoint topright = ccp(fieldsize.width, fieldsize.height); [self addstaticbodytospace:lowerright finish:topright radius:radius elasticity:elasticit

c# - Rotating matrices -

objectives imagine that, have matrix like a11 a12 a13 a21 a22 a23 a31 a32 a33 what want is, textbox value rotate matrix that, example if write 2 , press rotate , program must keep both diagonal values of matrix (in case a11, a22, a33, a13, a31) , rotate 2 times clockwise other values. result must like a11 a32 a13 a23 a22 a21 a31 a12 a33 it must work n x n size matrices, , see every 4 rotation takes matrix default state. what i've done so idea that, have 2 forms. first takes size of matrix (1 value, example if it's 5, generates 5x5 matrix). when press ok generates second forms textbox matrix that form 1 code private void button1_click(object sender, eventargs e) { int matrixsize; matrixsize = int.parse(textbox1.text); form2 form2 = new form2(matrixsize); form2.width = matrixsize * 50 + 100; form2.height = matrixsize *60 + 200; form2.show(); //this.hide(); } form 2 code gener

asp.net - Change row color of gridview by database Values -

i making application in asp.net shows values in gridview database.in database having colmn named statusid has value of 1 or 2 or 3. i tried show grid view rows in different color statusid values. never works. how can in asp.net. here code protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { connection.open(); sqlcommand command1 = connection.createcommand(); command1.commandtext = "select statuscolor status statusid=(select statusid fileinfo userid=(select userid userinfo email='" + session["email"].tostring() + "'))"; (int = 0; < gridview1.rows.count; i++) { using (sqldatareader reader = command1.executereader()) { while (reader.read()) { statusid = reader["statuscolor"].tostring(); } gridview1.rowstyle.backcolor = color.fromname(statusid);

access denied while accessing a sharepoint 2013 list over http using rest -

i trying access sharepoint 2013 list using rest on https i used following syntax https://name.sharepoint.com/sites/sitename/_api/web/lists but respond error says access denied. not have permission perform action or access resource should give permission somewhere?what might wrong request? in future post on sharepoint.stackexchange.com bud faster answer, saw accident on google query. basically design, isn't giving permission pre authorised accounts direct access without authentication , security trimmed after that. otherwise need authenticate against api oauth. the rest api being massive subject cannot possibly cover here recommend google: "using oauth sharepoint rest api" some links are: http://msdn.microsoft.com/en-gb/library/jj164022.aspx http://www.sharepointnutsandbolts.com/2013/01/calling-sharepoint-search-using-rest-eg.html good luck matey.

Mysql - TABLE field layout using sql statement -

is there format sql statement result given following........ table1 id ticket_number 1 2001 2 2002 table2 tn name create_time 2001 sms_to_customer 2013-05-05 10:10:19 2001 sms_to_officer1 2013-05-05 11:17:01 2001 sms_to_officer2 2013-05-05 12:14:05 2002 sms_to_officer1 2013-05-05 09:17:01 2002 sms_to_officer2 2013-05-05 09:30:05 i want result like........ ticket_number sms_to_customer sms_to_officer1 sms_to_officer2 2001 2013-05-05 10:10:19 2013-05-05 11:17:01 2013-05-05 12:14:05 2002 na 2013-05-05 09:17:01 2013-05-05 09:30:05 if values column name on table2 , can use static version of query, select tn, coalesce(max(case when name = 'sms_to_customer' create_time end), 'na') `sms_to_customer`, coalesce(max(case when name = 'sms_to_officer1' create_time end), 'na') `sms_to_offi

addclass - jquery add numeric class to an element based on current class of another element -

i have following html <ul id="tabs"> <li>1</li> <li>2</li> <li>etc...</li> </ul> and following jquery function using append "buttons" traversing "up" or "down" list, while "showing" current item: $('#tabs li').first().attr('class', 'current'); $('#tabs li').each(function(i) { = + 1; $(this).attr('id', 'tab-' + i); if(i !== $('#tabs li').size()) { $(this).append('<a class="tabpagination next floor-up" rel="tab-' + (i + 1) + '" href="/keyplate/' + (i + 1) + '">up</a>'); } if(i !== 1) { $(this).append('<a class="tabpagination next floor-down" rel="tab-' + (i - 1) + '" href="/keyplate/' + (i - 1) + '">down</a>'); } }); $('#

java - Unable to connect to MS SQL Server 2008 using a JAR from command prompt but runs successfully in Eclipse -

i trying connect sql server 2008 using sqljdbc4.jar , connect using eclipse. but when export code jar , try run using command prompt, error : d:\eclipse\testdbjar>java -djava.ext.dirs=lib -jar testdb.jar apr 5, 2013 11:17:17 com.microsoft.sqlserver.jdbc.tdschannel enablessl info: java.security path: c:\program files\java\jre6\lib\security security providers: [sun version 1.6, sunrsasign version 1.5, sunjsse version 1. 6, sunjgss version 1.0, sunsasl version 1.5, xmldsig version 1.0, sunpcsc versio n 1.6] sslcontext provider info: sun jsse provider(pkcs12, sunx509 key/trust factories, sslv3, tlsv1) sslcontext provider services: [sunjsse: keyfactory.rsa -> sun.security.rsa.rsakeyfactory aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1] , sunjsse: keypairgenerator.rsa -> sun.security.rsa.rsakeypairgenerator aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1] , sunjsse: signature.md2withrsa -> sun.security.rsa.rsasignature$md2withr

java - EndContact of ContactListner(Box2d) not called everytime in LibGDX -

i new in box2d , trying implement in libgdx game. want detect collision between various bodies. so,i made class collisiondetection , implement contactlistener in gives me 4 overridden methods i.e. begincontact() , endcontact() have deal with. passing object of collisiondetection class in world.setcontactlistner(collisiondet) overridden methods of collisiondetection class called when bodies in world class collide each other. problem occuring when bodies collide begincontact() method called everytime endcontact() method not called everytime when bodies lost contact.so, possible ways can detect endcontact() everytime. the code of collisiondetection class follow: public class collisiondetection implements contactlistener { static fixture fixturea; static fixture fixtureb; public static boolean colliding=false; world world; protected collisiondetection(world world, long addr) { this.world = world; // todo auto-generated constructor stub } @override public void beg

Django count by group -

i need create report in can value each month of year. models.py class ask(models.model): team = models.charfield(max_length=255) date = models.datefield() in team 3 possible values: a, b, c. how calculate how many times month added individual team? i generate report each year. i suggest add month field model , pass there month on save . run this: from django.db.models import count ask.objects.filter(date__year='2013').values('month', 'team').annotate(total=count('team')) other method use extra parameter , extract month date field: from django.db.models import count ask.objects.filter(date__year='2013').extra(select={'month': "extract(month date)"}).values('month', 'team').annotate(count('team')) but extract method database dependent , example dont`t work in sqlite

php - Change image size on click of button in jQuery -

i working on image upload , need add functionality image shapes. there buttons landscape, portrait, square , panoramic. when user clicks of these, div shape change accordingly. this code square shape when click on square shape, stretches image. want change shape of div without stretching image. $('#square').on('click', function(){ var images = $("#uploadedimage"); for(i=0; i<images.length; i++) images[i].onload = centerimage(images[i]); function centerimage(img) { if (img.width > img.height ) { var y = 160; var x = img.width/img.height*y; var marx = (x-y)/2; img.style.height = y+"px"; img.style.marginleft = -(marx) + "px"; } } }); it's difficult recreate running example without more generalized code, function changes dimensions of variable img, image passed in function, , not div or other element besides image cl

Length of identifier in turboc++ and DevC++ for both C and C++ languages? -

i want know length of variable identifiers of c , c++ in turbo c++ , dev-c++ is. devc++ uses mingw port of gcc(g++ c++) hence has unlimited identifier length turboc++ : use in switch on tcc max identifier length.

c - Segfault resulting from pthread? -

i have been beating head on wall several hours trying find causing segfault. i have found segfault occurs consistantly on pthread_mutex_lock(lock) line (38). have placed 2 print statements surrounding lock however, 1 of them prints, justification concluding segfault occurs @ instruction. am using mutex lock correctly, or making mistake arrays (buffer[] , numbermarker[] ? #include <stdio.h> #include <stdlib.h> #include <pthread.h> int* numbermarker = null; int* buffer = null; int pullposition = 0; int placeposition = 1; pthread_mutex_t *lock; int ceiling; /*this method places 1 of primes in buffer. offers safe way manage next value placed*/ void placevalue(int value) { buffer[placeposition] = value; placeposition++; } /*this method pulls next prime , increments next prime in list*/ int takevalue() { pullposition++; return buffer[pullposition-1]; } void* threadmethod() { int k; int l; int firstval; while(1) {

java - struts2 conventions plugin not working properly -

i trying run application convention plugin struts2. application fine struts.xml configured this: <struts> <package name="struts2demo" extends="struts-default"> <action name="hey" class="action.countryaction" method="get"> <result name="success">/index.jsp</result> </action> <action name="add" class="action.countryaction" method="add"> <result type="redirect" name="success">hey</result> </action> <!-- add actions here --> </package> </struts> now removed struts.xml , added annotations this: @namespace("/") @resultpath(value="/") public class countryaction extends actionsupport implements modeldriven<country>{ private list<country> worldcountry; private country country = new country(); public country g

osx - Where are the POSIX message functions (msgsnd, msgrcv, etc) man pages in Mac? -

i wanted view manual pages posix standard message functions: msgsnd, msgrcv, etc. of them defined in sys/msg.h , code using them works. manual pages found, neither in computer (mac os x mountain lion 10.8.3), in friends' (os x lion) or in developer pages of apple in internet. where can download manual can access right terminal? apple has not published man pages family of functions. suggest filing bug report @ http://bugreport.apple.com/ requesting published. in mean time use freebsd man pages reference that's os x implementation originated.

transition - Android: overridePendingTransition giving force close -

in app have imageview performing sliding animation, below code: public class addresspopupactivity extends activity { private final string tag = addresspopupactivity.class.getsimplename(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.addressbookmenu); listview menusearchlistview = (listview) findviewbyid(r.id.popuplist); popupmenuutils popupmenuutils = new popupmenuutils(); activity parent = (activity) activitiesbringe.getobject(); addresspopupadapter addresspopupadapter = new addresspopupadapter(this,parent, r.layout.popupmenurow, popupmenuutils.getpopuppabutil(this),r.layout.popupmenurow); log.d(tag, "onactivitycreated step 05"); menusearchlistview.setadapter(addresspopupadapter); imageview custommenu = (imageview) findviewbyid(r.id.custom_menu);

haskell - show returning wrong value when used with unsafeCoerced value -

i experimenting unsafecoerce int8 , word8 , , found surprising behaviour (for me anyway). word8 8 bit unsigned number ranges 0-255. int8 signed 8 bit number ranges -128..127. since both 8 bit numbers, assumed coercing 1 safe, , return 8 bit values if signed/unsigned. for example, unsafecoerce (-1 :: int8) :: word8 expect result in word8 value of 255 (since bit representation of -1 in signed int same 255 in unsigned int). however, when perform coerce, word8 behaviour strange: > ghci, version 7.4.1: http://www.haskell.org/ghc/ :? > import data.int > import data.word > import unsafe.coerce > class showtype typename :: -> string > instance showtype int8 typename _ = "int8" > instance showtype word8 typename _ = "word8" > let x = unsafecoerce (-1 :: int8) :: word8 > show x "-1" > typename x "word8" > show (x + 0) "255" > :t x x :: word8 > :t (x + 0) (x + 0) :: word8 i don'

CUDA: Instruction fetch issues -

Image
i have written kernel has issues instruction fetching. more 75% of issue stall reasons due instruction fetch. i have no clue of how improve this. nvidia not instruction fetch policies , nsight documentation doesn't bring light either: "instruction fetch stall reason if next assembly instruction has not yet been fetched." is there way of how avoid issue (or reduce impact) ?

c# - Problems with ClickOnce deployment (to me, it's so annoying)? -

i've tried clickonce first time deploy sql server compact application. think kind of deployment unprofessional: the output setup folder including 3 objects, 1 folder named application files , setup.exe , .application file i've never seen in professional product setup package. plus, clicking setup.exe seems user install application user has no chance select location s/he wants install application. it's installed default @ somewhere in target computer. , tried looking location after installation, couldn't find it. the last, after installation, there folder named " microsoft " in programs menu, , installed application shortcut located in there. wonder why microsoft ? tried editing company info in assembly info through project properties window. application shortcut strange when can't find target executable file in properties window. with above clickonce can bring me, consider funny job testing application not publishing commercial applicatio

is there a concept of Shortcuts/Alias/Pointer in R? -

i working on rather large dataset in r split in several dataframes. the problem things whole set, need work or modify parts of set , selectors getting clunky, f.e. alistofitems$attribute4([alistofitems$attribute1 == true & alistofitems$attribute2 == 6 & alistofitems$attribute3 == "c"),] <- alistofitems([alistofitems$attribute1 == true & alistofitems$attribute2 == 6 & alistofitems$attribute3 == "c"),alistofitems$attribute5] * alistofitems([alistofitems$attribute1 == true & alistofitems$attribute2 == 6 & alistofitems$attribute3 == "c"),alistofitems$attribute7] (this sets attribute 4 (attribute5 * attribute6) selected part of entries.) this horrible read, understand , edit. splitting these different dataframes not option due ram , because refresh data regulary , rebuilding seperate dataframes pain. so, there way like items_t6c <- &(alistofitems([alistofitems$attribute1 == true & alistofitems$attribut

for loop - Java string index out of range -

so string index out of range means i'm exceeding range of collection, i'm not quite sure how i'm doing code. this code supposed read text file contains 3 ints( first 2 being relevant number of rows , number of columns respectively) , series of characters. first reads , saves first 3 numbers, converts rest of file string. follows setting array of chars dimensions of text file , filling in values characters of text file character character. however, when try print out code, encounter string index out of range error , cannot find problem. this code: import java.util.*; import java.io.*; public class snakebox { // instance variables private char[][] box; private int snakecount; private int startrow, startcol; private int endrow, endcol; private int rows, cols, snakes; scanner keyboard = new scanner(system.in); /** create , initialize snakebox reading file. @param filename external name of plain text file */ public snakebox(string filename

html - select option font-size -

i have built this fiddle example of doing. what trying works fine in firefox. font-size being 14px when open select options. however looking @ in google chrome picks inherited font-size of 34px . i ideally looking select options font size 14px . is possible do? i willing make relevant fixes in jquery should required. thanks code listed below...... my css : .styled-select { overflow: hidden; height: 74px; float: left; width: 365px; margin-right: 10px; background: url(http://i50.tinypic.com/9ldb8j.png) no-repeat right center #5c5c5c; } .styled-select select { font-size: 34px; border-radius: 0; border: none; background: transparent; width: 380px; overflow: hidden; padding-top: 15px; height: 70px; text-indent: 10px; color: #ffffff; -webkit-appearance: none; } .styled-select option.service-small { font-size: 14px; padding: 5px; background: #5c5c5c; } html markup : <div class=&q

Passing path as argument to process C# -

i have following code trying call c++ console app c#. log file keeps telling me can't open config file. proper way write path argument in case? process process = new process(); process.startinfo.filename = "c:\\mycapp.exe"; process.startinfo.arguments = "c:\\config.txt"; // put arguments here process.startinfo.useshellexecute = false; process.startinfo.createnowindow = true; process.start(); process.waitforexit(); your method right (just tested sample). think problem in c++ application or in wrong file access. may file opened in c# application , not closed yet?

jquery ui - Google map Splitter layout -

is there layout http://layout.jquery-dev.net/samples/gispaho/layoutintab.htm suport google map contend use above one. got problem, splitter drag fails on google map. ref https://stackoverflow.com/questions/15795815/jquery-dragable-fails-over-the-google-map what tried <div id="layout" class="sun-layout" style="height: 600px;"> <div class="ui-layout-west sun-layout"> <div class="map1"> </div> </div> <div class="ui-layout-center sun-layout"> <div class="map2"> </div> </div> in dom ready var $layout = $("#layout"); $layout.layout({ west__size: 400 }); we had same problem in our application. show invisible div on map on start of resize , hide @ end. div temporarily stop mouse events reaching map. imagi

flex4 - outline flex 4 fxg graphic -

i'm trying add thick border edge of fxg shape (shapes:munch2 id="paper") in flex 4 represent bleed area. please can suggest way this, need variable width, rather setting when draw fxg thanks david <?xml version="1.0" encoding="utf-8"?> <s:module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:shapes="fxggraphics.shapes.*" width="100%" height="100%"> <fx:declarations> <!-- place non-visual elements (e.g., services, value objects) here --> </fx:declarations> <fx:style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx"; @namespace shapes "fxggraphics.shapes.*"; #paper { border: 3px solid

html - HTML5 semantics & outlines -

i discovered whole html outline thing , found great online html5 outliner tool . i'm trying accomplish semantically proper simple html page outline should this: page nav main sub aside footer and render page this: | --- nav ----------------- | | content | | --- main ---------------- | | content | | --- sub ----------------- | | content | aside | | --- footer -------------- | | content | the html looks follows: <!doctype html> <html> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <div class="page"> <header class="page--header"> <hgroup> <h1>page</h1> <h2>subtitle</h2> </hgroup> <nav> <h1>nav</h1> <ul>

ruby - How do I do a really simple Sinatra LDAP authentication? -

i looked @ sinatra docs , seem reference http authentication. i'm looking simple way control access routes based on user being authorised/authenticated via ldap server. i've built class ldap bit , returns ldap object if user has authenticated , nil if haven't: >>directoryuser.authenticate('user', 'password') #<directoryuser:0x007ffb589a2328> i can use determine if they've authenticated or not. as next step want splice simple sinatra app provides form collect ldap user , password: require 'directoryuser' require 'sinatra' enable :sessions '/form' username = params[:username] password = params[:password] haml :form end then want allow routes if 'directoryuser' object exists: get '/protected' # if directoryuser object exists "this route protected" end '/unprotected' "this route unprotected" end i've spent hours try

ruby on rails - two different actions on same button -

i developing 1 simple demo application room reservation have 3 tables member_types, customers, , donors the models follows class membertype < activerecord::base has_one :donor has_many :customers has_many :room_rates attr_accessible :member_type end class customer < activerecord::base belongs_to :member_type has_one :donor has_many :rooms has_many :room_types has_many :room_rates end class donor < activerecord::base belongs_to :customer belongs_to :member_type attr_accessible :donation, :free_days, :used_days,:customer_id end i have added member_types donor, guest , 2 other admin when customers add basic info select member_type donor , submitting stores info in customer table how can add customer_id in donor table when customer submit info? you can use active record callback in customer model, this: class customer< activerecord::base after_save :new_donor private def new_donor new_record = donor.new(:customer_id

c++ - Why i don't have a correct answer for ro? -

#include<stdio.h> #include <math.h> int main() { float pb; float n; float ro; float nb; printf(" find number of charges , users \n \n \n "); printf(" please enter probability \n "); printf(" probability "); scanf("%f",&pb); printf("\n \n please enter number of circuits n \n"); printf("the number is"); scanf("%f",&n); while ( pb>0.01 ) { pb=1/(1+n/(ro*pb)); ro=ro+0.01; } printf("%f",ro); } you need to, @ least, initialize variables don't read user. right now, doing math using "random" value.

Global classes with Meteor >0.6.0 and CoffeeScript -

since release of meteor 0.6.0 , addition of file-level javascript variable scoping , i'm facing issue using coffeescript classes, each of them being defined in own respective file. foo.coffee: class foo ... subfoo.coffee: class subfoo extends foo ... as expected, , because of changes introduced in meteor 0.6.0, i'm getting following error: referenceerror: foo not defined here's question: how should 1 handle class definitions across files coffeescript , meteor >0.6.0? ideally: there convenient way not modify way classes defined in order make sure these definitions (and core parts of application) not meteor-dependent? as noted in coffeescript section of docs : global variables can set in coffeescript using (or coffeescript's @ shorthand) as turns out, coffeescript classes can defined like: class @foo which compiles to: this.foo = (function() { function foo() {} return foo; })(); assuming foo.coffee loaded befor

ios - Disable Key-Value Observing in Objective C -

i don't use kvo, performance reasons, make sure disable properly. from apple key-value observing programming guide automatic support (for kvo) provided nsobject , default available properties of class key-value coding compliant. typically, if follow standard cocoa coding , naming conventions, can use automatic change notifications—you don’t have write additional code. is mean every property generated xcode has willchangevalueforkey , didchangevalueforkey methods implemented? if there way (some flag or something) disable behaviour? i'm using accessinstancevariablesdirectly , returning no, i'm not sure if enough. i don't use kvo. you cannot know that. cocoa framework classes or other foreign code might depend on kvo without knowledge. also, nsobject's kvo uses technique called isa-swizzling automatically augment observed objects dynamically subclassing them. means there's no overhead on objects not observed. your other questio

c# - SVCUtil skip complexType of a wsdl to avoid duplicates -

i have multiple wsdl files downloaded on local - a.wsdl , b.wsdl a.wsdl has same set of complex type (nearly 100) of b.wsdl <xsd:complextype name="book"> methods/operations different. for example: a.wsdl has complex type <xsd:complextype name="book"> , operations being create new operations b.wsdl has same complex type <xsd:complextype name="book"> , operations being read operations i using svcutil generate stubs on client end single file , stubs same namespace. getting below error: error: there error verifying xml schemas generated during export: complextype http://mylocalhost/object:book has been declared. the constraints are: 1) not able change wsdl files. 2) place generated stub classes in single name space. 3) no wsdl.exe is there way either duplicated complextype skipped or overwritten? i quote daniel roth has provided here "i think looking /sharetypes feature in wsdl.exe. if want co

css - Adjust table automatically -

i've table containing 1 row of radio options , 2 paragraphs out of 1 displayed , hidden based on value selected user in radio options. the issue is, 2 paragraphs of different content length making 1 paragraph consuming more space in table. when user selects option display bigger paragraph, table expands automatically fit bigger content. again laterm if user selects radio option display small paragraph, not shrink should shrink fit small paragraph. is there handle in css? thanks. you try add css below, if not work, please paste codes here further investigation? hope helps. table-layout:fixed;

c# - How to bind session values in Crystal Reports -

i need bind session values crystal reports using parameter. how can bind it? read topic programmatically-pass-parameters-into-crystal-report

ruby - disable an image based on what page are you on -

i have strange issue implement. i've been thinking time cannot come solution. so lets visited www.rene.com/promotions/hitman .on rhs of page have side bad showing other promotion images. want hide image hitman sidebar. cut story short, when on promotion page, picture on right sidebar related promo visited wont show. right hand sidebar uses loop , loads of images. how can relate right hand sidebar promotion visited? thing in common name of promo , folder promo images: promo link: www.rene.com/promotions/hitman sidebar image: /img/promotions/hitman/250x90.jpg solution 1 find matching data between current environment , data in loop iterating. can find useful information in request . instance if image wish skip has src or href , can match against request environment url (usually request.env['path_info'] ) or similar. if href of image/link same path info in request, should skip current iteration ( next ) since rendering link page on. solution 2 worki