Posts

Showing posts from April, 2014

strip string from url in Python -

input: url = http://127.0.0.1:8000/data/number/ http://127.0.0.1:8000/data/ consistent each page number. output: number instead of slicing url url[-4:-1] , there better way it? you can use combination of urlparse , split . import urlparse url = "http://127.0.0.1:8000/data/number/" path = urlparse.urlparse(url).path val = path.split("/")[2] print val this prints: number the output of urlparse above url parseresult(scheme='http', netloc='127.0.0.1:8000', path='/data/number/', params='', query='', fragment='') we utilizing path portion of tuple. split on / , take second index.

AngularJS Dynamic Slider Control -

i working on project requires slider control corresponds image , or multitude of div objects. spacing of slider irregular (the steps [1,4,7,13,14,16...]). steps correspond specific spots on image , or specific div object. perfect slider dynamic , re-size screen may impossible. the hard part unable use jqueryui, instead limited using controls work angularjs. i have been looking hours , cannot find starting point. question whether has found slider control use angularjs? this 1 fits of criteria angularjs-slider

asp.net - error handing for uploading large size file -

how can send message user if file uploaded exceeds maximum limit on server side using asp.net. have wriiten following code in global.asax sub application_error(byval sender object, byval e eventargs) dim ex new exception ex = server.getlasterror() if typeof ex httpunhandledexception andalso ex.innerexception isnot nothing ex = ex.innerexception end if if (ex isnot nothing) , ex.message.contains("maximum request length exceeded") server.clearerror() server.transfer("/errors.aspx") end if end sub it not display erros page instead internet explorer cannot display webpage that's late in cycle. test in application_beginrequest this: sub application_beginrequest(byval sender object, byval e eventargs) dim runtime httpruntimesection = ctype(webconfigurationmanager.getsection("system.web/httpruntime"), httpruntimesection) ' approx 100 kb(for page content) size has been deducted bec

c++ - wxComboBox adding hover effect -

here code in c++ when initialize frame in wxwidgets: wxpanel *panel = new wxpanel(this, wxid_any); combo_list = new wxcombobox(panel,id_combobox); combo_list->append("guitar"); combo_list->append("violin"); connect(id_combobox, wxevt_command_combobox_selected, wxcommandeventhandler(combobox::onselect)); however, there no default hover effect, background color changing when move mouse on specific selection. , find hour on google still cannot find it. can told me how make hover effect? i want implement 2 drop down lists. content in first 1 has been determined before running program. in order 1 content determined after choose directory.

Webpack bundle-loader trying to load non-existent file -

i'm trying use webpack's bundle-loader asynchronously load pikaday datepicker component (i want load pikaday on pages use it). seems i've managed build working correctly -- additional js file generated includes pikaday, , base bundle not -- code bundle-loader generates request new file looks incorrect url. the relevant code looks this: my datepicker component imports pikaday bundle-loader: import pikadayloader 'bundle!pikaday'; . uses so pikadayloader(pikaday => { this.picker = new pikaday({ field: react.finddomnode(this.refs.dummyinput) }); }); my webpack config has output looks this: output: { path: path.join(__dirname, '../sandbox', 'dist'), filename: 'app.js' }, so js files being built dist directory within sandbox project. page uses scripts sandbox/index.html . when build code, pikaday bundle indeed generated @ sandbox/dist/2.app.js . but webpack-generated loader looks @ sandbox/2.app.js -- without

angularjs - CSS for Drag & Drop UX -

Image
i should preface saying css skills rather lacking. problem i utilizing angular drag & drop directive - angular-drop-and-drop-lists . when switch on horizontal list i'm trying drag boxes, dndplaceholder element (i.e. grey box) doesn't style want to. plunkr http://plnkr.co/edit/1bupv6rr4hoangyrzb1t?p=preview placeholder css .simple-demo ul[dnd-list] .dndplaceholder { display: inline-block; background-color: #ddd; min-height: 42px; min-width: 100px; margin: 1px; } screenshot desired resolution what want dndplaceholder vertically aligned other elements in list. red square marks desired location. you need add vertical-align: bottom; .dndplaceholder style rules.

c++ - VC++ 2010 Express | Compiler removes some code from my project -

i'm using vc++ 2010 express. i have code that: if(strlen("aa") == strlen("bb")) messagebox("aa == bb"); else messagebox("aa != bb"); in built executable there bytes "aa == bb", there no "aa != bb". means compiler optimizes predictable code. there way disable this? cheers, kamil. add #pragma function(strlen) to program @ beginning.

Python anotation arrow direction -

Image
i trying annotate scatter plot in python 2.7, matplotlib. here plot code: import pandas pd import numpy np import matplotlib.pyplot plt df = pd.dataframe(np.random.rand(5,3), columns=list('abc')) df.insert(0,'annotation_text',['abc','def','ghi','jkl','mnop']) q = 2 pqr = 1 # scatter plot: x = df['a'] y = df.iloc[:,q] plt.scatter(x, y, marker='o', label = df.columns.tolist()[q]) # plot annotation: plt.annotate(df.iloc[pqr,0]+', (%.2f, %.2f)' % (x.ix[pqr],y.ix[pqr]), xy=(x.ix[pqr], y.ix[pqr]), xycoords='data', xytext = (x.ix[pqr], y.ix[pqr]), textcoords='offset points', arrowprops=dict(arrowstyle='-|>')) # axes title/legend: plt.xlabel('xlabel', fontsize=18) plt.ylabel('ylabel', fontsize=16) plt.legend(scatterpoints = 1) plt.show() as can see, main line line starting plt.annotate(df.iloc[pqr,0]+', (%............... . i think main problem part of p

cakephp ->set() a value in an object -

i can use cakephp set() add value in object @ top level need set value object inside object , can seem access it. possible? i need add business_id inside employee object. i though might use $user->set->employee('business_id', '1'); error on employee part. object(app\model\entity\user) { 'email' => 'dfgdfg@sdfsdf.com', 'new_password' => 'ttt', 'confirm_password' => 'ttt', 'employee' => object(app\model\entity\employee) { 'name' => 'dsfsfsdfsfd', 'email' => 'sdfsdfsdf@sdfsdf.com', 'surname' => 'sdfsdfsdfsdf', 'employee_num' => 'sdfsdfsdfsd', '[new]' => true, i tried couple of different ways , got work $user->employee->set('business_id', '1');

procedures - MYSQL return a single row query with a format -

i got procedure : delimiter $$ create procedure `countrows`(in v varchar(30)) begin set @t1 =concat("select count(*) ",v); prepare stmt3 @t1; execute stmt3; deallocate prepare stmt3; end$$ delimiter ; and want return query in format : "the table x contains y rows" tried use concat function don't work me. some tips? thanks i able make work using subquery. couldn't find way concat , count search @ same time, wrapping count subquery , using value in select clause able return expected results. try this: select concat("the table contains ", tmp.numrows, " rows.") from( select count(*) numrows mytable) tmp; here sql fiddle example of query itself, not prepared statement.

Error when using QuickBooks PHP DevKit examples -

i have setup quickbooks php devkit, trying run example_customer_add script sandbox. when do, following error: notice: undefined variable: context in /applications/mamp/htdocs/quickbooks-php/test_qb.php on line 54 i've tried track down $context variable, used on place, , i'm unsure of being set, etc... any appreciated! thanks! edit i'm using script included in docs folder of quickbooks php devkit: <?php require_once dirname(__file__) . '/config.php'; require_once dirname(__file__) . '/views/header.tpl.php'; ?> <pre> <?php $customerservice = new quickbooks_ipp_service_customer(); $customer = new quickbooks_ipp_object_customer(); $customer->settitle('ms'); $customer->setgivenname('shannon'); $customer->setmiddlename('b'); $customer->setfamilyname('palmer'); $customer->setdisplayname('shannon b palmer ' . mt_rand(0, 1000)); // terms (e.g. net 30, etc.) $customer-

node.js - Node JS with Socket IO Winston Logger not outputting debug -

i'm trying have winston logging output logger.debug node.js/socket.io project i'm working on can't debug show in console. i create logger with: var logger = new (winston.logger)({ transports: [ new (winston.transports.console)() ] }); on connection i'm trying the debug has connected io.on('connection', function (socket) { socket.emit('init','init-yes'); logger.debug("socket.on has connected"); logger.log('debug', 'this debug'); ... but nothing appears in console. checked out git page still seem not understanding something. edit suggested updated logger creation to: var logger = new winston.logger({ transports: [ new winston.transports.console({ level : 'debug' }) ] }); but i'm still not getting logger.debug("message here") work. any appreciated. thank time! the fine manual states: "note default level of transpo

Excel formula that reads a color in one cell and puts a value in another based on that color -

i trying set if statement formula read color of 1 cell , place value in based on color. have tried writing several if statements cant find 1 read color. sheet set read date cell. have conditional formatting set color weekends. need value "200" show on days not on weekends , "0" show on weekends. if able conditional formatting, should able use similar formula input value. guessing reads date cell, figures if weekend or not , inputs value.

javascript - How can I use XSL in tandem with Bootstrap? -

so working on web page takes data xml file , uses parts of data c# file create links displayed on page. page displays these in table via xslt. super new web development , started learning xml, html, bootstrap, , xslt week ago. goal reformat whole page still using same xml create links. made mock how want site don't know how use xsl within bootstrap create links once more. bootstrap mock up: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <!-- html5 doctype --> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- setting width runs on mobile or desktop --> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- ie compatibility --> <meta name="description" content=""> <title>sap web application links [table view]</title> <!-- latest compiled , minified css --> &l

python - get text oustside tags using Beautifulsoup -

i new , having hard time getting specific text outside of tags using beautifulsoup. here code: from bs4 import beautifulsoup soup = beautifulsoup(''' <li id="salesrank" style="list-style : none"> <b>sellers rank:</b> #81 in fun (<a href="http://www.google.com">see top 100</a>) </li> ''') therank = soup.find('li', attrs={'id':'salesrank'}).find('b', text="sellers rank:") print therank.find_next_sibling().text.strip() i trying #81 in fun the full text element after <b> tag include ( opening parenthesis. use .next_sibling attribute next object given tag: >>> soup.find('li', attrs={'id':'salesrank'}).find('b', text="sellers rank:") <b>sellers rank:</b> >>> soup.find('li', attrs={'id':'salesrank'}).find('b', te

Compare Pre-Post tables in oracle sql without hardcoding -

i took pre-image/post-image of table before , after ran batchjob. pre_table id|name |phone |score 1 |john |145678 |10 2 |ptr |23456789 |20 3 |sarah |34567890 |30 4 |mary |45678901 |40 post_table id|name |phone |score 1 |john |12345678 |10 2 |peter |23456789 |22 3 |sarah |34567890 |33 4 |mary |45678901 |40 how compare , extract modified fields , present them follows: desired output id|modifiedcolumn|modifiedval|prevval 1 |phone |12345678 |145678 2 |name |peter |ptr 2 |score |22 |20 3 |score |33 |30 so far, can modified rows using select * post_table minus select * pre_table which gives me id|name |phone |score 1 |john |12345678 |10 2 |peter |23456789 |22 3 |sarah |34567890 |33 i thinking of using all_tab_columns iterate fields in table select column_name all_tab_columns table_name ='pre_table'; i have written partial pl-sql procedure, got stuck when wanted compar

angularjs - how to reduce the height of header in tabel view or grid view? -

i trying make simple demo of grid view .in have header of title (having gray background) need reduce height of title or headers of table have gray background .can add alternate color of rows ? please see given image .it header or tittle small compared plunker .secondly there alternate color in row .can add in plunker . http://plnkr.co/edit/7bsnk0fu0nbof1giwhsk?p=preview .search.list-inset, .search.list-inset .item:first-child { border-radius: 50px; } .search .item-input .icon { font-size: 200%; } .gray-20 { background-color: #eee; } @media (min-width: 600px) { .search { width: 50%; margin-left:auto; margin-right: auto; } } .mrginrightleft{ margin-left:5%; margin-right:15%; } .brd{ border: 1px solid grey; } here code![enter image description here][1] updated plunker how style striped rows there 2 ways this. 1 pure css using :nth-child(even) or (odd) pseudo classes. can add class row , use style how want, such as: my-class:nth-chil

java - Cannot create new excel sheet in a workbook using apache POI -

i trying copy multiple files in singe excel file. each sheet in excel file carry contents of 1 file. , there around 6 files need copy. resultant file should contain 6 sheets. when run code 1 sheet generated single file. tried debugging not figure out reason. this code. public static void main(string[] args) throws ioexception { // todo auto-generated method stub createsingleexcelfile cef = new createsingleexcelfile(); cef.fileiterator(); } public void fileiterator() throws ioexception{ file dir = new file("path files copy"); file[] dir_listing = dir.listfiles(); hssfworkbook my_wb = new hssfworkbook(); //creating output stream copy files in combined.xls bufferedoutputstream bos= new bufferedoutputstream(new fileoutputstream("path of resultant excel sheet")); //traversing through list of files for(file file: dir_listing){ //file: file copied. add_in_excel(my_wb,bos,file);

c# - Returning an enumeration of events on particular date -

i trying write function returns enumeration of 'appointment' items consists of following code - public interface iappointment { datetime start { get; } int length { get; } string displayabledescription { get; } bool occursondate(datetime date); } the function supposed retrieve 'appointments' items out of list. have instanced list @ top of class accessed globally methods implemented ilist interface. here function far public ienumerable<iappointment> getappointmentsondate(datetime date) { foreach (iappointment item in _list) { if(item.start.date == date.date) { return item; // error appears here under 'item' } } } error: cannot implicitly convert type '....iappointment' 'system.collections.generic.ienumerable<...iappointment>' . explicit conversion exists (are missing cast?) this assignment spec function: getappointmentsondate - retrieves enumerat

neo4j - Can I count the precedence relation if all the paths on the same set of nodes -

Image
the path representing users' browse history. i'm considering design structure should take. for example, the red path means user has browsed [page a]-> [page b]-> [page b]-> [page c]-> [page b]-> [page a] the blue path means user has browsed [page c]-> [page d]-> [page a] if want select browse path page c earlier page a , the answer should blue path how design query in cypher query , which design suitable case? thank you. design 1 (each path share same nodes) design 2 (each path should has own nodes.) update i tried apply query in model, i want know if node 5231 before node 7222 but couldn't output. match p=(x)-[*0..]->(y {code: '5231'}) not ()-->(x) return p order length(p) limit 1; data model data download creating disjoint subgraphs each path wasteful, , not make easier solve use case. here query (that works unified graph) finds path (or 1 of them, if ther

file - Ceph- list object in a RADOS block device -

my question quiet simple: possible list files in block device? for instance, if create new pool : ceph osd pool create mypool and inside pool add rados block device : rbd create myblock -p mypool --size 1024 on ceph-client do: sudo rbd map myblock -p mypool sudo mkfs.ext4 -m0 /dev/rbd/rbd/myblock sudo mkdir /mnt/ceph-block-device sudo mount /dev/rbd/rbd/myblock /mnt/ceph-block-device cd /mnt/ceph-block-device i put files in block touch myfile.txt touch hello.txt how on osd/mon node can see thoses files , stored? know : ceph osd map -p mypool object1 works perfectly, how can see complete list inside pool mypool? regards, ghislain

java - Simple JavaEE HTML GET/POST application -

i'm starting out javaee (i'm decently fluent in javase) , having trouble wrapping brain around new things required make simplest of applications. right trying use jax-rs annotations generate simple "hello world" html page in intellij using glassfish 4. i've searched around proper use of these annotations, , seems i'm doing correctly, keep getting 404 no matter navigate in localhost. i'm starting think i'm missing vital components in code, , don't know enough javaee know i'm missing (perhaps in web xml file, don't know about). here code wrote, minus imports: @localbean @stateless @path("/hello") @produces("text/html") public class hello { @get @path("/world") public string printhelloworld() { return "<html lang=\"en\"><body><h1>hello, world!</h1></body></html>"; } } the server , running , application seems deploy correctly.

Dart How to prevent chrome back to previous page when user press DELETE or BACKSPACE -

how can prevent browser previous page when user press backspace or delete in dart? i have listening key events this: // keyboard event streamsubkey = window.onkeyup.listen((keyboardevent e) { switch (e.keycode) { case keycode.backspace: case keycode.delete: // , stop browser previous. break; } }); case keycode.backspace: should enough, delete doesn't navigate anywhere. just add e.preventdefault(); . you want skip e.preventdefault(); when current element input element or textarea. if(!(e.target inputelement || e.target textarea)) { e.preventdefault(); } not tested

ms access vba: sorting is not working -

i trying sort elements of field manually without using built in function. below code function test(myval variant) variant dim rst dao.recordset dim arr() double dim arr_lenght long dim integer dim j integer dim k integer dim temp double dim count integer dim index integer set rst = currentdb.openrecordset("select [salary (t) total] salaryt") count = 1 index = 0 rst.movefirst while not rst.eof on error resume next arr(count) = cdbl(rst![salary (t) total]) count = count + 1 rst.movenext loop arr_length = ubound(arr) - 1 'this sorting algorithm = 1 arr_length j = (i + 1) arr_length if arr(i) < arr(j) temp = arr(i) arr(i) = arr(j) arr(j) = temp end if next

mysql - Validating Uniqueness within data in another Table -

i have student , student_section model. student table have student_id , roll_no , student_section have student_id, standard_id , section_id . roll_no should unique in standard , section . in student.rb file i'm having trouble setting custom validation roll_no unique in standard , section present in student_section model. i'm having trouble implementing, can help? if using rails 4, can define relation of model , if true, duplcates omitted collection. has_many :student_sections, -> { uniq }, through: :students and if using rails < 4 version, try this has_many :student_sections, :through => :students, :uniq => true

html - Ensure Dynamic inputs fill 50% of browser width -

this time i've got problem input boxes. if add 3 of them, they're taking 50% of browser window in width. when add more, stretching on sides. want them fit in 50% of browser window no matter how many of them here. solutions? page1 (normal) * { box-sizing: border-box; } h1 { font-family: verdana, tahoma, sans-serif; font-size: 150px; font-style: normal; font-weight: 400; line-height: 170px; letter-spacing: -8px; border: 10px solid #66004c; } input { margin: auto; padding: 25px; font: normal 15px verdana, tahoma, sans-serif; width: 100%; border-left: solid 5px #66004c; border-right: 0; border-top: 0; border-bottom: solid 3px #66004c; background: #cdcdcd; -webkit-transition: 0.2s linear; -moz-transition: 0.2s linear; -ms-transition: 0.2s linear; -o-transition: 0.2s linear; transition: 0.2s linear; } input:hover, input:focus { -webkit-background: #c299b7; -moz-background: #c299b7; backgroun

Finding indices of element in array ruby -

how can find indices of elements in array has particular value in ruby? i.e. if have array [2,3,52,2,4,1,2], there easier way use loops, indices of 2 in array? answer [0,3,6], if looking 2. answer in get index of array element faster o(n) gives solution if want find 1 instance of given element. a # => [2, 3, 52, 2, 4, 1, 2] b = [] # => [] a.each_with_index{|i, ind| b << ind if == 2} # => [2, 3, 52, 2, 4, 1, 2]

python - django static folder name change -

my django project located @ c:/django/project , static folder @ c:/django/project/app/static . put bootstrap , jquery files template under link href="/static/ , src="/static/ . if change name of folder static files, become unavailable. tried change settings.py settings , here code, isn't also. static_url = '/static/ template_dirs = [os.path.join(base_dir, 'templates')] staticfiles_dirs = (os.path.join(base_dir,'/django/lingsite/inputs/static'),) static_root = os.path.join(base_dir, '../static/') where static files folder defined? you doing wrong, see docs: https://docs.djangoproject.com/en/1.8/howto/static-files/ this correct way locate static files: {% static "my_app/myexample.jpg" %} but anyway, have misconfigured paths: static_root = os.path.join(base_dir, 'static')

.htaccess - You don't have permission to access /magento/ -

i've put on host in magento in sub-folder /magento/ , when try open http://example.com/magento/ got error forbidden you don't have permission access /magento on server. i know .htaccess file because if remove/rename can open don't know can in .htaccess. had problem before , can give info how fix it? i'll post lines not commented in default .htaccess directoryindex index.php <ifmodule mod_php5.c> php_flag magic_quotes_gpc off php_flag session.auto_start off php_flag suhosin.session.cryptua off php_flag zend.ze1_compatibility_mode off </ifmodule> <ifmodule mod_security.c> secfilterengine off secfilterscanpost off </ifmodule> <ifmodule mod_ssl.c> ssloptions stdenvvars </ifmodule> <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewriterule ^api/rest api.php?type=rest [qsa,l] rewriterule .* - [e=http_authorization:%{http:authorization}] rewritecond %{request_metho

How to profile a PHP shell script app or worker using Blackfire -

i noticed when have endless worker cannot profile php shell scripts. because when it's killed doesn't send probe. what changes shall do? when trying profile worker running endless loop. in case have manually edit code either remove endless loop or instrument code manually call close() method of probe ( https://blackfire.io/doc/manual-instrumentation ). that's because data sent agent when close() method called (it called automatically @ end of program unless killed it). you can manually instrument code using blackfireprobe class comes bundled blackfire's probe: // probe main instance $probe = blackfireprobe::getmaininstance(); // start profiling code $probe->enable(); // calling close() instead of disable() stops profiling , forces collected data sent blackfire: // stop profiling // send result blackfire $probe->close(); as auto-instrumentation, profiling active when code run through companion or blackfire cli utility. if not, calls conve

ios - Alamofire "installation" not working (red text in Embedded Binaries) -

Image
i trying add alamofire xcode v6.3.2 project it's not working me. followed steps in readme github repo when select framework add "embedded binary" shows red text , not available me in code. does know why might be? tried add brand-new, blank project same results. i'd advise use cocoapods. here how that: first brew. open terminal , paste in there: ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)" then cocoapods. run command in same terminal: sudo gem install cocoapods after you've done navigate xcode project in terminal (be sure replace yourprojecthere project's name): cd ~/documents/xcodeworkspace/yourprojecthere in folder run command: pod init after running pod init file have been created called: podfile. edit file typing: vi podfile at first file contain: # uncomment line define global platform project # platform :ios, '6.0' target 'yourproject' end

javascript - Cordova 5 whitelist, Content-Security-Policy and local network ip -

i error when trying load js files refused load script ' http://192.168.1.10/js/test.js ' because violates following content security policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' what policy should use? this meta <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> and white list in config.xml (root) <access origin="http://192.168.1.10/*" /> <allow-navigation href="http://192.168.1.10/*" /> <allow-intent href="http://192.168.1.10/*" /> i'm building on platform cordova 5, android@4.0.2 , testing on android 5.1.1 found solution, thought i'd post, forgot add url meta. hope helps :) <meta http-equiv="content-security-policy" content="default-src *; style-src &

php - What stops someone from forging a password reset link? -

i'm creating profile system website, , i'm @ point i'm coding password reset function in php. basically, i'm asking user email address, setting random md5 password , emailing them , comes in link formatted like www.mysite.com/reset.php?email=myemail@myemail.com&hash=hashgoeshere what point in hiding passwords behind md5 when forge password reset link , use hash value instead of password? you should opt workflow like: generate new guid, save against user account, call passwordresettoken the email send should redirect user /reset.php?email=myemail@email.com&resettoken=xxxxxxxxxxx you verify reset token exists user account specified ask user enter new password of choice , save it. nullify saved reset token cannot used again it extremely/statistically unlikely guess link set someone's password chose, unless (a) reset request made account, , (b) can happen guess guid generated.

c - Is there a way of getting dirent's ent->d_name as w_char *? -

i generate list of files using dirent l getting worried directories , files contain unicode characters. void recurse_dir(char *dir) { dir* d; d = opendir(dir); struct dirent* ent; unsigned short int dir_size = strlen(dir), tmp_dir_size; if(d != null) { while((ent = readdir(d)) != null) { if(ent->d_type == dt_dir) { if(!strcmp(ent->d_name,".") || !strcmp(ent->d_name,"..")) continue; folder_count++; char tmp_dir[dir_size + strlen(ent->d_name) + 2]; tmp_dir[0] = '\0'; strcat(tmp_dir,dir); strcat(tmp_dir,"/"); strcat(tmp_dir,ent->d_name); recurse_dir(tmp_dir); } else { file_count++; file_strs_size += dir_size + strlen(ent->d_name) + 2; fp

javascript - read dynamic data from json -

read json 'var dt='{"var1":"1","var2":"2"}';' data every 1 second, in json data i've given static data 1,2, in program var1, var2 value change dynamically. need post dynamic data in text boxes, i've tried set interval function, no use:( needed, $(document).ready(function() { $.ajaxsetup({cache: false}); var dt='{"var1":"1","var2":"2"}'; var data=$.parsejson(dt); if (data.var1) { $('#c1-cycle').val(data.var1); } if (data.var2) { $('#c2-cycle').val(data.var2); } }); try json.parse(dt); instead of $.parsejson(dt); . if var1 , var2 changes, need use: $.each(dt, function (key, value) { // key => var1 or whatever latest // value => value stored in key if (key == "var1") { $('#c1-cycle').val(dt[key]); } if (key == "var2") { $('#c2-cycle').val(dt[key]);

javascript - Using Jquery Raty in Rails 4 and showing average of star rating -

i have rails app in using jquery raty plugin have included raty in gemfile gem 'jquery-raty-rails', github: 'bmc/jquery-raty-rails' and in application.js have included //= require jquery.raty //= require jquery.raty.min and have included in javascript $('#star-log').raty({ target : '#hint-log', targettype : 'score', targetkeep : true }); $('#star-comm').raty({ target : '#hint-comm', targettype : 'score', targetkeep : true }); $('#star-tech').raty({ target : '#hint-tech', targettype : 'score', targetkeep : true }); $('#star-overall').raty({ target : '#hint-overall', targettype : 'score', targetkeep : true, readonly : true }); the view stars rating given as <div class="row"> <div class=" col s12 m6 logical"> <label>logical &a