Posts

Showing posts from February, 2011

javascript - ExtJS 4.2 Grid Header doesn't show correctly in IE -

the purpose of following code popup window contains 2 column grid. works fine in safari , firefox fails show in ie 8 , ie 10 (which our customers insist on using). in ie, 3rd hidden column not hidden, cover 1st column instead. i use default css of extjs 4.2, matter? <link rel="stylesheet" type="text/css" href="js/extjs-4.2.1.883/resources/css/ext-all.css"> and here javascript: ext.define('base.lov_4_2', { extend: 'ext.form.triggerfield', defaultautocreate : {tag: "input", type: "text", size: "16",style:"cursor:default;", autocomplete: "off"} ,triggercls: 'x-form-search-trigger' ,lovtitle: '' ,view: {} ,window:null ,windowconfig: {} ,showlov: function() { this.renderwindow(); this.window.show(); } ,onrender: function(ct, position){ base.l

Trouble with CSS animation in Firefox and Internet Explorer -

i know has been answered somewhere else, can't seem find solution , implement it. have , css slider animation works in safari , chrome not in firefox , ie. have tried use vendor selectors doing wrong. first time code , given week class. last thing have do. how can animation work in ie , firefox? you can visit site here . here html <div id="captioned-gallery"> <figure class="slider"> <figure> <img src="images/hungarian-goulash_10-20-13_1_ca.jpg" width="600" height="400" alt="photo of hungarian sausage goulash"/> <figcaption class="slider2">hungarian sausage goulash</figcaption> </figure> <figure> <img src="images/g-lasagne-al-forno.jpg" width="600" height="400" alt="photo of lasagne al forno"/

string - Python: Rabin-Karp algorithm hashing -

i implementing rabin-karp algorithm fun. came across pseudocode: rabin -karp -matcher (t, p, d, q) 1 n = t.length 2 m = p.length 3 h = d^(m-1) mod q 4 p=0 5 t= 0 6 = 1 m / preprocessing / 7 p = (dp + p [i]) mod q 8 t = (dt + t [i]) mod q 9 s = 0 n-m / matching / 10 if p == t 11 if p [1... m] == t [s + 1...s + m] 12 print “pattern occurs shift” s 13 if s < n-m 14 t = (d(t-t[s + 1]h) + t [s + m + 1]) mod q i implemented in python 2.7 so: def rabin_karp_matcher(text, pattern, d, q): n = len(text) m = len(pattern) h = pow(d,m-1)%q p = 0 t =0 result = [] in range(m): # preprocessing p = (d*p+ord(pattern[i]))%q t = (d*t+ord(text[i]))%q s in range(n-m): if p == t: # check character character match = true in range(m): if pattern[i] != text[s+i]: match = fa

symfony - symfony2 form field label as an array -

i'd have 3 separate texts each field in form label. separate, because need styled differently. tried this: $builder->add('total_sales', 'text', array( 'label' => array('num' => '1', 'descr' => 'total sales', 'category' => 'a'), 'required' => false, 'attr' => array( 'class' => 'field numeric_field', 'maxlength' => 10, ))); obviously above don't work; display 'array' in place of label. how can achieve desired effect? first you'll need create custom form type extends text type, reason don't mess other text types might have elsewhere. after doing you'll need style using form_div_layout. can see details here: http://symfony.com/doc/current/cookbook/form/form_customization.html

scala - Couldn't package a cron job using sbt-native-packager when building a deb bundle -

i trying package cron part of debian package ( https://github.com/indykish/megam_akka.git ). the debian package built using sbt-native-packager. placed cron script inside bin directory here https://github.com/indykish/megam_akka/blob/master/bin/megamherk.cron.d i changed build.sbt pickup megamher.cron.d here https://github.com/indykish/megam_akka/blob/master/build.sbt i have attached snippet of code here: linuxpackagemappings in debian <+= (basedirectory) map { bd => (packagemapping((bd / "bin/herk_stash") -> "/usr/share/megamherk/bin/herk_stash") withuser "root" withgroup "root" withperms "0755") } linuxpackagemappings in debian <+= (basedirectory) map { bd => (packagemapping((bd / "bin/megamherk.cron.d") -> "/etc/cron.d/megamherk") withuser "root" withgroup "root" withperms "0755") } i ran: sbt clean compile sbt dist:dist sbt debian:packagebin

python - how to run the django server on hostname? -

i wanted run django server on hostname in local system. django has own server ... runs on localhost:8000 want run on cpanel-django.django-project.com:8000 i tried using: python manage.py runserver cpanel-django.django-project.com:8000 i getting error: validating models... 0 errors found march 06, 2014 - 06:21:24 django version 1.6.2, using settings 'moclient.settings' starting development server @ http://cpanel-django.django-project.com:8383/ quit server control-c. error: [errno -5] no address associated hostname you need edit hosts file , rename localhost cpanel-django.django-project.com .

permissions - php exec python script that writes file -

i need execute python script writes file in same directory. test.py : print 'hi! executed' test2.py : filename = 'sample.txt' target = open(filename,'a') target.write("something something") target.close() php script: <? exec('python test.py',$output1,$ret1); exec('python test2.py',$output2,$ret2); ?> the first exec works fine second script not, return var $ret2 1. both commands work fine in terminal. guess permission issue php scripts executed 'nobody'. thanks in advance try give full path filename = 'sample.txt' for e.g. filename = '/home/pranjal/sample.txt'

php - how to format json with array of json -

i want output in json this response:{url="www.google.com/raj.png", size=12.344kb},{url="www.google.com/raj2.png", size=12.344kb},{url="www.google.com/raj4.png", size=12.344kb} but getting "url=> www.google.com/img1.png size => 12.344 kb,url=> www.google.com/img2.png size => 12.344 kb" //using loop here { $response[] = array('url' => 'url_value','size' => 'file_size'); } //without loop hardcoded values: $response = array ( array('url' => "www.google.com/raj.png",'size' => "12.344kb"), array('url' => "www.google.com/img2.png",'size' => "10.344kb") ); return json_encode($response);

Jquery hover delay best method? -

i trying figure out best way make project work. please view bootply: http://www.bootply.com/119281 (bootply because bootstrap project) here's breakdown of want do: on pageload bottom bar visible @ "full" height. if there no mouse enter within 5 seconds close "mid" height, show heading. on mouseover, bottom bar go "full" height @ pageload. on mouseout, there delay before bottom bar goes "mid" height. while bottom bar @ "full" height, columns inside bar have there own animation. using css column animations. the 1 coded ok bit jerky (but sometimes). i know if im doing correct or there way accomplish this. appreciated. mahalo in advance!

javascript - Prototype methods not seen in NodeJS session -

i'm trying learn javascript , nodejs building small game, , i'm running problem. when attach object session, whenever reaccess session no longer have access prototype methods define on it. in 1 file called 24.js , have function deck() { this.cards = []; (var = 0; < 52; i++) { this.cards[i] = math.floor(i / 4) + 1; } this.done = false; } function gamestate() { // holds game state , game logic this.time = 0; this.score = 0; this.deck = new deck(); this.deck.deal(); } deck.prototype.deal = function() { // not important } var gamemaker = exports = module.exports = function() { return new gamestate(); } then in main file have var express = require('express'); var gamemaker = require('./24.js'); var app = express(); app.use(express.static(__dirname + '/static')); app.use(express.urlencoded()); app.use(express.cookieparser()); app.use(express.session({ secret: 'supersecret', k

Custom progressdialog in android created dynamically -

i've created progressdialog in asynctask dynamically. use custom style app. when did progressdialog style changed white color need default style in black white text. my java file: class logintask extends asynctask<void, void, void> { private final progressdialog dialog = new progressdialog(login.this); @override protected void onpreexecute() { this.dialog.setmessage("logging in..."); this.dialog.show(); } // prog @override protected void onpostexecute(void result) { if (this.dialog.isshowing()) { this.dialog.dismiss(); }} my style.xml : <style name="appbasetheme" parent="android:theme.light"> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> <item name="android:windowbackground">@drawable/blue</item> <it

php - download an existing file using codeigniter -

Image
i'm trying make website can download jpg,png,pdf,docx file uploaded admin. uploading content working without problem. when uploading insert file name in mysql table well. using table i'am showing uploaded file names users. this code i'am using display files. <?php if (!empty($downloads)) { foreach ($downloads $val) { ?> <div class="col-md-3 col-sm-6 col-xs-12"> <div class="panel panel-danger"> <div class="panel-heading panel-title"> <?php echo $val['upload_description']; ?> </div> <div class="panel-body"> <?php echo $val['file_name']; ?> <div class="clear-fix clear clearfix"></div>

ios - How to test my podspec file without having to commit my changes all the time? -

i writing library pod (used pod lib create ) , trying figure out how structure files since have mix of static libraries, non-arc files , arc files. thus, making several changes , run pod spec lint name.podspec in order pass validation. i haven't specified remote yet (that should fine now, right?) podspec looks that: s.source = { :git => "/volumes/development/pods/pod_name", :commit => "aaf6d439349bf05a7399db3cd3b0fe3980eef1f7" } but means every time make change, need commit changes , replace new commit sha-1 in podspec, save, , lint again. but doesn't seem correct way it, right? workflow wrong here? you can specify :head in podfile if you're testing way ( docs ) otherwise can leave :commit key out of source hash , should pull newest source. leave :git key.

javascript - While adding a div content into another div on click of a button -

here code -- <div id="div1"> div 1 <form class="thisformtobeaddeverytime"> <!-- form add on click #btn1 --> </form> </div> <div id="div2"> div 2 <form class="thisformtobeaddeverytime"> <!-- form add on click #btn2 --> </form> </div> <div id="showtheaddedform"> //here form push on click button </div> <button type="button" id="btn1">add form1</button> <button type="button" id="btn2">add form2</button> // click function in js file - $(document).on("click","#btn1",function(){ $("#showtheaddedform").append($("#div1").html()); }); $(document).on("click","#btn2",function(){ $("#showtheaddedform").append($("#div2").html()); }); no

how to get last updated column name from mysql -

is possible particular updated column name record? if so, please me. since creating history table store updated column , values rest of tables. please suggest me correct way deal this.... i believe not possible. however, can create update trigger monitors table's columns , have trigger insert records in history table. hope helps.

java - Two different classes A and B on their own thread calling a method of the same class instance C -

so i've got simple server class creates instance of listener class every connection made "server". listeners run on own thread. i there might concurrency control problem when invoking methods on server class alter files/variables. happens if 2 listeners try invoke method e.g. returns information server status? can same server instance handle 2 calls @ same time? or 1 of listeners have wait till server done executing method of first caller? thanks guys might able provide! if method not synchronized, server can handle 2 calls concurrently. but if ask status, means status changes on time. , if changes on time, accesses, read , write, status should done in synchronized way. otherwise, listener threads see obsolete value of status. so method should synchronized, or status should atomicxxx value, or should volatile. best, , correct solution hard give without seeing code , knowing how status read , modified.

c# - display count in textbox -

i have simple problem. have table in dataset designer have query select count(sex) male, count(sex) female tblpersonalinfo can please show me how display male , female count in 2 textboxes? , can please check if query correct? i'm newbie in visual studio c# 2010. form previous projects, use these retrieve data database , display in textbox. public maindatabasedataset.tblpositiondatatable getpositiondata(string data) { maindatabasedatasettableadapters.tblpositiontableadapter returnposition = new maindatabasedatasettableadapters.tblpositiontableadapter(); return returnposition.getdatabyposition(this.txtsearch.text.trim()); } } private void btncompletesearch_click(object sender, eventargs e) { maindatabasedataset.tblpositiondatatable getpositioncommand1 = getpositiondata(this.txtsearch.text); maindatabasedataset.tblpositionrow getpositioncommand2 = (maindatabasedataset.tblpositionr

netbeans 7.4 linux mint install error -

i try install netbeans 7.4 html5 , php develop version on linux mint 15 olivia.but installer throw error wthi next message: * error in `/usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200': double free or corruption (out): 0x089f5720 * ======= backtrace: ========= /lib/i386-linux-gnu/libc.so.6(+0x767e2)[0xb765d7e2] /lib/i386-linux-gnu/libc.so.6(+0x77530)[0xb765e530] /lib/i386-linux-gnu/libz.so.1(+0xd8fb)[0xb77a88fb] /lib/i386-linux-gnu/libz.so.1(deflateend+0x3c)[0xb77a01dc] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x8057911] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x8057ad6] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x804eee0] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x8058adc] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x8048f87] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0xb7600935] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200[0x8048fad] ======= memory map: ======== 08048000-080

java - Giving exception while mapping the simple value type of collection in hibernatre -

i have entity called person has name property string , person petnames has collection. when mapping hibernate getting exception. how can resolve problem? /* * change template, choose tools | templates * , open template in editor. */ package com.myapp.struts; import java.io.serializable; import java.util.set; import javax.persistence.collectiontable; import javax.persistence.elementcollection; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.joincolumn; /** * * @author hyva */ @entity public class person implements serializable { private static final long serialversionuid = 1l; private long id; @id @generatedvalue(strategy = generationtype.auto) public long getid() { return id; } public string getname() { return name; } public void setname(string name) { this.name = name; }

.net - How to add header using Filehelper with DataTableToCSV -

i using: datatabletocsv(datatable,filepath) to create csv file. generating perfect csv. how add column names when using datatabletocsv? you can use following: [delimitedrecord(","), ignorefirst(1)] public class person { // must specify fieldorder [fieldorder(1), fieldtitle("name")] string name; [fieldorder(2), fieldtitle("age")] int age; } ... var engine = new filehelperengine<person> { headertext = typeof(person).getcsvheader() }; ... engine.writefile(@"c:\people.csv", people); reference https://gist.github.com/1391429

asp.net mvc 4 - RedirectingtoAction not working in MVC controller -

i trying redirect page url http://somedomain.com/admin/#/admin/partial1 , wrote code in controller. redirecting url http://somedomain.com/admin/%23/admin/partial1 , page not landing. if remove %23 generated url page landing perfectly. please me how solve problem. [httppost] public actionresult partial1(string email) { //some thing code.. return redirecttoaction("/#/admin/partial1"); }

javascript - Replace multiple string items in the array -

i have array shows value "135_1,undefined,undefined" i have find "undefined" in above array , replace "0_0".undefined can occur multiple times in array. i used var = myvariable.replace("undefined", "0_0"); alert(extra); but have use 3 times every single time can search 1 , replace it. i have used this:: (var = 0; < myvariable.length; i++) { alert(myvariable[i]); myvariable[i] = myvariable[i].replace(/undefined/g, '0_0'); } alert(myvariable); but did'nt solved purpose. string.prototype.replace method accessible strings. undefined not string. this might you. for (var i=0, len=arr.length; i<len; i++) { if (arr[i] === undefined) { arr[i] = "0_0"; } } alert(json.stringify(arr)); you use array.prototype.map this. note, works in ie >= 9 arr = arr.map(function(elem) { return elem === undefined ? "0_0" : elem; });

inheritance - In Python, class from which a given instance is inheriting a particular method -

i know in python, given class classa , inspect.getmembers(classa, predicate=inspect.ismethod) i can iterate on different methods present in classa . inherited methods gathered, convenient in case. need is, given particular method method1 of classa , class classa inherited method1 . might classa itself, or of parents/grandparents. thought recursively traverse __bases__ attribute, looking method1 attribute @ each step. maybe functionality implemented somewhere. there way? look through mro (method resolution order), using inspect.getmro() (which works on both old , new-style classes): def class_for_method(cls, method): return next((c c in inspect.getmro(cls) if method.__func__ in vars(c).values()), none) there no stdlib method search you, no. demo: >>> import inspect >>> def class_for_method(cls, method): ... return next((c c in inspect.getmro(cls) ... if method.__func__ in vars(c).values()), none

ios - No known class method for selector when using blocks -

i new use block syntax , facing below problem. below code calling static method of class causing problem. below code called click of next button on bar . there mistake on syntax of code? -(bool) shouldperformseguewithidentifier:(nsstring *)identifier sender:(id)sender { if (![sender iskindofclass:[uibarbuttonitem class] ]) { return true; } // trim spaces self.stewardsnametextfield.text = [self.stewardsnametextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset] ]; self.tracknametextfield.text = [self.tracknametextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset] ]; self.curatornametextfield.text = [self.curatornametextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset] ]; bool isvalid =[jltvalidator validatefields: @[self.stewardsnametextfield, self.tracknametextfield, self.curatornametextfield, self.weatherconditionsegment,

Check the sensor data every 0.5 seconds Android -

there onsensorchanged(sensorevent event) listener android sensor. triggered whenever tiny change in sensor data. how can check sensor reading every 0.5s instead of whenever sensor data has changed? i'm afraid can not set interval callback triggered since passing sensormanager.sensor_delay_normal parameter cause trigger more once every half second . check values sensor_delay below. sensor_delay_ui (60,000 microsecond delay) sensor_delay_fastest (0 microsecond delay) sensor_delay_normal) (200,000 microseconds delay) so, receive callbacks every 0.2 seconds , implement way doyourprocedure() once every 2.5 ticks.

java - Unable to connect to SQL server on localhost -

i keep getting connection failed, dont know why, im running server on uniserverz , trying sql file localhost. im using uniserverz (unicontroller.exe) , made .sqlite file using sqlite manager addon firefox. can me out here? thanks! edit: ok, im trying load sqlite file c drive, have commented out command load localhost because doesnt work either. help? package ui; import java.sql.*; import javax.swing.*; public class mysqlconnect { connection conn=null; public static connection connectdb(){ try{ class.forname("org.sqlite.jdbc"); connection conn = drivermanager.getconnection("jdbc:sqlite:c:\\uniserverz\\home\\database\\db"); // connection conn = drivermanager.getconnection("jdbc:mysql:\\localhost:3306\\database\\db\\student.sql","root","root"); joptionpane.showmessagedialog(null, "connection successful!"); retur

Finding maximum (max) text-item in a list using python -

why max function operates differently in 2 list below: >>> list1=['the school','boy', 'the wise old man'] >>> max(list1) 'the wise old man' list2=['made', 'with', 'then', 'happy home', 'came', 'this', 'them', 'from', 'have', 'into'] >>> max(list2) 'with' obviously in list2, 'happy home' is supposed 'max' has more number of text others in list. any ideas why? thanks. max() compares strings lexicographically; found element sorted last. thus, 'the wise old man' comes after the school , alphabetically speaking. to longest string instead, pass function key argument of max() : max(list2, key=len) generally speaking, without key function, max() find value value > othervalue true other values in input sequence. the key argument, if provided, gives max() different value compare decide i

python - Create text file of hexadecimal from binary -

Image
i convert binary hexadecimal in format , save text file. the end product should this: "\x7f\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x8b\x52" input executable file "a". current code: with open('a', 'rb') f: byte = f.read(1) hexbyte = '\\x%02s' % byte print hexbyte a few issues this: this prints first byte. the result "\x" , box this: 00 7f in terminal looks this: why so? , finally, how save hexadecimals text file end product shown above? edit: able save file text with txt = open('out.txt', 'w') print >> txt, hexbyte txt.close() you can't inject numbers escape sequences that. escape sequences constants, so, can't have dynamic parts. there's module this, anyway: from binascii import hexlify open('test', 'rb') f: print(hexlify(f.read()).decode('utf-8')) just use hexlify function on byte string , it'll give hex byte

Set required to select validation for dropdown list in asp.net razor -

how can apply selection required validation on dropdownlist in asp.net razor without using model. below dropdownlist <td>@html.dropdownlist("units", new selectlist(@viewbag.settings.cdcportalrentinfo , "cdcportalrentinfoid" , "description") , new { style = "width:250px" }) </td> try required attribute in mvc public class cdcportalrentinfo { [required(errormessage="your error message")] public int cdcportalrentinfoid{ get; set; } public string description {get;set;} }

mysql - How to update table with subselect -

i trying join output subselect fields in update table. can't right using mysql. any idea how correctly? update instrumentdailyinfo info set info.vwap = (select t1.vwap instrumentday t1 join (select date(tradedate) date_date, stockname, min(tradedate) min_date instrumentday group date_date , stockname) t2 on t1.tradedate = t2.min_date , t1.stockname = t2.stockname order t1.tradedate , t1.stockname asc) t1.tradedate = info.tradedate , t1.stockname = info.stockname select `instrumentdailyinfo`.`id`, `instrumentdailyinfo`.`closeprice`, `instrumentdailyinfo`.`highvalue`, `instrumentdailyinfo`.`lowvalue`, `instrumentdailyinfo`.`startprice`, `instrumentdailyinfo`.`stockname`, `instrumentdailyinfo`.`tradedate` `instrumentdailyinfo`; select `instrumentday`.`id`, `instrumentday`.`stock

c# - Merging multiple pointpairlist -

Image
i have .wav file , plotting waveform using zedgraph. calculating energies of .wav file of each second , if energy less 4 want draw sample in different color. have created 2 pointpairllist , lineitem there problem while merging these 2 list. here code , how graph appears. lineitem mycurveaudio; lineitem mycurveaudio2; pointpairlist list1 = new pointpairlist(); pointpairlist list2 = new pointpairlist(); while(true) { (int = 0; < fmainbuffer.length; i++) { float segmentsquare = fmainbuffer[i] * fmainbuffer[i]; listofsquaredsegment.add(segmentsquare); } float energy = (float)math.sqrt(listofsquaredsegment.sum()); if (energy < 4) { (int = 0; < read; += (int)window) { list1.add((float)(count / ((float)read / (float)window)), fmainbuffer[i]); count++; } } else { (int = 0; < read; += (int)window) { list4.add((float)(count / ((float)read / (float)window)), fmainbuffer[i]); count++; } } } zgc.masterpane.panelist[1].xaxis.

ios - Creating a custom slider using Sprite Kit - how do I pass a @selector? -

a sprite kit game i'm working on uses custom slider act color picker (the color picked slider track graphic, uiimage containing gradient). i looked using customised uislider , standard ios ui controls don't play sprite kit's scenes: they're difficult position relative rest of scene (as exist subview of main view rather part of skscene ), pop existence (rather transitioning rest of scene) , must manually removed when exiting scene. in short, implementing them pain, , don't integrate seamlessly. i've started implementing custom slider using skspritenode s, building on graf 's excellent skbutton class , , have slider track , handle in place. handle sliding left , right along track, , setting value between 0 , 1 (just uislider ). i've called class skslider . what pass skslider @selector , in same way uislider , can define function inside skscene slider execute: [myslider addtarget:self action:@selector(slidervaluechanged:) forcontrolevents:ui

Grails custom jquery configuration -

org.codehaus.groovy.grails.web.taglib.exceptions.grailstagexception: no javascript provider configured i have exception when using taglib in grails. using jquery without jquery plugin. how configure our custom jquery files grails, recognizes jquery javascript library? in config.groovy should able set: grails.views.javascript.library="jquery" but if using jquery without plugin should write js instead of depending on tag generate you.

sql - mysql if statment on same row across a Group by statment -

Image
hello have giant join has problem. now test made test table like create table `table1` ( `cartarticleid` int(11) null default null ) create table `table2` ( `cartarticle_id` int(11) null default null, `testvalue` int(11) null default null ) now populated first table 1 entry , joined other one. and other now query made select table1.cartarticleid, if(table2.testvalue = 1, 1, null) lol, if(table2.testvalue = 3, 1, null) lol3 table1 inner join table2 on table1.cartarticleid = table2.cartarticle_id and produces this. but here lies problem query has group cartarticleid , crap dous first entry , noth other 1 in 1 row like: select table1.cartarticleid, if(table2.testvalue = 1, 1, null) lol, if(table2.testvalue = 3, 1, null) lol3 table1 inner join table2 on table1.cartarticleid = table2.cartarticle_id group cartarticleid and there have it. lol3 empty. how can lol , lol3 filled there to??

How to add a button in Word VBA, visible in every new doument on a tool bar -

i have write macro, save template. of link ( http://support.microsoft.com/kb/246299 ) have added button run macro. problem can see button in document in working currently. i trying find out way, when user open word document, can see button on tool bar.

python - Haystack: stats() and stats_results() doesn't work -

i have following problem haystack , django. trying filter model books objects , max , min price. bellow query, sq dynamically generated query: partial_query = searchqueryset().models(books).filter(sq) this return 10 results. after checked documentation of haystack ( http://django-haystack.readthedocs.org/en/latest/searchqueryset_api.html ), found stats('price'), stats_results() work fine me, reason, output see none. below code: partial_query = searchqueryset().models(listing).filter(sq).stats('price') partial_query.stats_results() after few test, found following print that, expect do. print(partial_query[0].price) #for example 123 print(partial_query) #list 10 objects also if know other methods max , min price query, please feel free share me :). grateful help. thanks. from tags sounds you're using elasticsearch per haystack documentation this supported on solr only.

c++ - What's the difference between read() and getc() -

i have 2 code segments: while((n=read(0,buf,buffsize))>0) if(write(1,buf,n)!=n) err_sys("write error"); while((c=getc(stdin))!=eof) if(putc(c,stdout)==eof) err_sys("write error"); some sayings on internet make me confused. know standard i/o buffering automatically, have passed buf read() , read() doing buffering, right? , seems getc() read data char char, how data buffer have before sending data out? thanks while both functions can used read file, different. first of on many systems read lower-level function, , may system call directly os. read function isn't standard c or c++, it's part of e.g. posix . can read arbitrarily sized blocks, not 1 byte @ time. there's no buffering (except maybe @ os/kernel level), , doesn't differ between "binary" , "text" data. , on posix systems, read system call, can used read kind of devices , not files. the getc function higher level functio

regex - Bash, grep between two lines with specified string -

example: a43 test1 abc cvb bnm test2 kfo i need lines between test1 , test2. normal grep not work in case. have propositions? her awk these print test1 test2 awk '/test1/{f=1} /test2/{f=0;print} f' awk '/test1/{f=1} f; /test2/{f=0}' awk '/test1/,/test2/' test1 abc cvb bnm test2 these prints data between test1 test2 awk '/test1/{f=1;next} /test2/{f=0} f' awk '/test2/{f=0} f; /test1/{f=1}' abc cvb bnm

mySQL collation latin + chinese -

i have database uses roman text , chinese. in tables able sort case sensitively eg cat cat dog dog chinese coming after these. utf8_general_ci allows me combine english , chinese won't allow cat , cat separate, indexable items. latin1_general_cs won't allow chinese. does know way round this? thanks

java - Spring+Maven Property File not loading -

i trying access property file containing db configurations in maven + spring project. i following error: cannot load jdbc driver class '${db_driver}' my property file placed in src/resources folder. below tag load property files: <bean id="dbpropertyreader" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="order" value="1" /> <property name="locations"> <value>classpath:${appenv.deployment}.properties</value> </property> </bean> following tag uses properties loaded: <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="url" value="${db_url}" /> <property name="driverclassname" value="${db_driver}" /> <prop

null - Is there a quick way to check for nil args in a Clojure function? -

in phil hagelberg's ( technomancy ) gripes file states following clojure: nil everywhere , causes bugs difficult find source now phil smart guy has contributed lot clojure community, , uses stuff - thought worth pondering moment. one easy way manage nil args function throw error: (defn myfunc [myarg1] (when (nil? myarg1) (throw (exception. "nil arg myfunc"))) (prn "done!")) these 2 lines per argument reek of boilerplate. there idiomatic way remove them via metadata or macros? my question is there quick way check nil args in clojure function? there clojure language based solution these situations: http://clojure.org/special_forms#toc10 (defn constrained-sqr [x] {:pre [(pos? x)] :post [(> % 16), (< % 225)]} (* x x)) adapted requirements: (defn constrained-fn [ x] {:pre [(not (nil? x))]} x) (constrained-fn nil) => assertionerror assert failed: (not (nil? x)) ...../constrained-fn (form-init550

Rails 4 Custom Validations -

i have problem custom validator. have model price , looks this: class price < activerecord::base belongs_to :car validates :from_days, :to_days, :netto_price, presence: true, numericality: true validate :days_range_validation private def days_range_validation unless to_days > from_days errors[:to_days] << i18n.t('price.must_be_greater') end end end and problem when leave to_days , from_days blank in form, following error: undefined method `>=' nil:nilclass and goal use validator when from_days , to_days present, don't know how that. ideas? you should set :if option: validate :days_range_validation, :if => :days_ranges_present? # ... private def days_ranges_present? to_days.present? && from_days.present? end

c# - Processing AntiForgeryToken send with Ajax -

hello i'm following this tutorial: and i'm trying send ajax request include antiforgerytoken. here ajax request: $(document).ready(function () { @functions{ public string tokenheadervalue() { string cookietoken, formtoken; antiforgery.gettokens(null, out cookietoken, out formtoken); return cookietoken + ":" + formtoken; } } $('.z').on('click', function (event) { event.preventdefault(); $.ajax({ url: "/deviceusage/return", type: "post", contenttype: "application/json; charset=utf-8", datatype: 'html', headers: { 'requestverificationtoken': '@tokenheadervalue()' }, data: json.stringify({ dev: { deviceinstanceid: $('#deviceinstanceid').val(), userid: "1", storageid: $('#st

matrix - Represent similarities between lists in R -

Image
i have lot of lists containing different quantities of nominal elements. want compare every list every other list , every combination count how many elements 2 lists share. no statistician imagine outcome represented easiest in matrix. list1=["joe","hanna","alice"] list2=["martin","ted","joe"] list3=["hanna","ted","joe"] afterwards represent outcome graphically, maybe using heatmap or cluster representation. can give me hints how using r? else representation? lot! you can use crossprod , table , , stack (assuming data in form twl shared): data <- list(list1=c("joe","hanna","alice"), list2=c("martin","ted","joe"), list3=c("hanna","ted","joe")) crossprod(table(stack(data))) # ind # ind list1 list2 list3 # list1 3 1 2 # list2 1

javascript - Can't get jStorage to pull user object - keeps saying "user is null" -

i can't jstorage work. when test following code result "user null" how user return proper value , target attributes exist in mysql database. var user = $.jstorage.get('user'); console.log('user ' + user); did set user before it? try var user = $.jstorage.get("user"); if(!user){ user = 'someuser'; $.jstorage.set("user",value); }

java - Android activity starting twice on startup -

splashactivity .java public class splashactivity extends activity { private static string tag = splashactivity.class.getname(); private static long sleep_time = 4; // time display splash image // in seconds. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); // removes title bar this.setrequestedorientation(activityinfo.screen_orientation_portrait); this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); // removes setcontentview(r.layout.activity_splash); log.d("man", "starting app"); testhttp test = new testhttp(); test.test(); } here manifest <uses-sdk android:minsdkversion="8" android:targetsdkversion="18" /> <application android:allowbackup="true" andro

javascript - Change the content images randomly -

i want randomly show photos on home page on div id=content , div id=content-right. i've used function document.getelementbyid('content-right'); make grab div content-right img unable change photos on div randomly. assistance appreciated. here html: <body> <div id="header"> <ul> <div id="wrapper"> <li class="logo">liquor.com.ph</li> <li>homes</li> <li>offices</li> <li>products</li> <li></li> <li></li> </div> </ul> </div> <div id="center"> <div id="slider"> <ul class="slides"> <input type="radio" name="radio-btn" id="img-1" checked /> <li class="slide-container"> <div class="slide"> <img src