Posts

Showing posts from April, 2012

ios - perform segue from didReceiveRemoteNotification in appDelegate -

edit: before o further should have found solutions im trying if im using navagiation controller based app, thats not case here. ive create push notifications have job , have logged , recieved push, clicked push notification , recieved correct logs. my goal, want perform segue specific view controllers depending on job there going to. - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { nsstring *job = [[userinfo valueforkey:@"aps"] valueforkey:@"job"]; if([job isequaltostring: @"msg"]) { nslog(@"going message"); } if ([job isequaltostring: @"friend"]) { nslog(@"going friend request"); } if ([job isequaltostring: @"inv"]) { nslog(@"going invite notifications"); } if ([job isequaltostring: @"find"]) { nslog(@"going find notifications"); } } if([job i

php - Class inheritance - Calling properties and/or methods not in the parent class -

i'm trying understand class inheritance. suppose have following code (php): class { public function fire() { echo "fire!"; } } class b extends { public function water() { echo "water!"; } } class c extends b { public function lightning() { echo "lightning!"; } } $cobject = new c(); $cobject->fire(); my questions are even though fire() method not defined in class c nor class b, $cobject->fire() works. class c inherit not class b's methods, class a's methods? i'm trying find out how many levels deep inheritance go. is there term calling property or method not exist in current object instance, property or method exists in parent or ancestor class? edit: in other words, fire() not defined in class c, $cobject can still call fire(). there particular term/jargon concept? (or part of definition of "class inheritance") 1) class 'b' &#

javascript - Incorporating google maps api into chrome extension/alternative to document.write -

i trying incorporate google maps api chrome extension. however, found out manifest version 2 not allow document.write . there way around this? use callback url parameter when load maps api, , won't use document.write() . in normal web page might this: function initmap() { // create map object here usual } function loadmapsapi() { var script = document.createelement( 'script' ); script.src = 'http://maps.googleapis.com/maps/api/js' + '?sensor=false&callback=initmap'; document.body.appendchild( script ); } documentation example i don't know how interact chrome extension, that's how it's done in regular web page.

java - Libgdx: how to implement a dialog? -

good day sirs. i've been struggling dialog because keeps on saying should have table skin table i'm not using table. have skin ".atlas" file contains packed images graphical user interface such windows buttons. is there way resolve problem?aside ".json" there anyway? my modal dialog worked using stage. when wanted show it, changed inputprocessor dialogs internal stage other gui objects couldn't respond user input outside dialog. i found libgdx's dialogs overkill purposes. perhaps need skin dialog? if not i'd go approach. use texture atlas instead. can function skin strings used reference regions of image.

How can i add a Tooltip in chosen jquery plugin? -

Image
hi iam working on chosen jquery plugin , need add tooltip elements in chosen plugin. tried tweaking around in chosen didn't positive result. have idea? code: <div id="synonyms_div" style="height:auto;width:170px;"> <select id="tagger-tags" class="tagger-tags" multiple style="width:150px; font:7px;" tabindex="4"> @foreach(var tag in viewbag.tags) { <option id="sel-tags" value="@tag.id" parent="@tag.parent_id" style="font:6px;"> @tag.name [@tag.el_count] </option> } </select> </div> <script> $(document).ready(function () { jquery(".tagger-tags").chosen({ search_contains: true }); }); </script> here's possible solution without having use other libraries, or els

machine learning - launch.asp error when launching a course from LMS -

just wondering if has seen these type of issues? one: when learner launches scorm package our lms preseted blank screen "launch.asp error". unable take course though meet technical requirements. real problem , have exhaused troubleshooting options. please. two: when learners complete course , launch exam never shows in achievment page. think course window looses connection parent window (lms) when complete exam can't write lms stays on learning plan page. thanks in advance help. nancy you need provide more information. lms using - 1 you've built, or 1 provided company? scorm package come - again, 1 you've built yourself, or bought somewhere? however, there can try narrow down problem is. scorm cloud lms can used test things relating scorm, can create free account. go http://cloud.scorm.com/ , open free account. load package lms, , see if runs. if works perfectly, package fine , lms has problem - contact lms provider, details of package

jquery - What to use instead of Object.keys()? -

i need find in jquery can work in ie8 real browsers. i'm brand new jquery, following code works in modern browsers: $('#field_'+office_id).on('change',function(){ offices = $(this).val(); for(var i=0; i<=object.keys(southland.address).length;i++){ if(offices == object.keys(southland.address)[i]){ address = southland.address[offices]object.keys(southland.address[offices])[0]]; } } where southland.address comes external array. works perfect in chrome, ie10 , ff, can ie8? to support object.keys in older browsers, can use snippet: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/keys#compatibility if (!object.keys) { object.keys = (function () { var hasownproperty = object.prototype.hasownproperty, hasdontenumbug = !({tostring: null}).propertyisenumerable('tostring'), dontenums = [ 'tostring', 'tolocalestring

html5 - How to update slider web control on every page visit using JQuery Mobile -

i creating jquery mobile web app , on 1 page have javascript gets values stored in html5 local storage , updates web controls on page values. 1 of web controls slider control. i need javascript execute every time page visited update controls local storage. applicable jquery events find fire @ every page pageshow , pagebeforshow events tried tie code execute during these events. example follows: var onpageshow = function () { // restore setting values device browser local storage if (localstorage.getitem("mmb_autologin")) { $('#autologin').val(localstorage.getitem("mmb_autologin").tolowercase()); $('#autologin').slider('refresh'); } }; $(document).delegate('#maxsettings', 'pageshow', onpageshow); the problem error when trying reference slider: 0x800a01b6 - javascript runtime error: object doesn't support property or method 'slider' i need refresh slider web control aft

php - How to retrieve parent category when using grouped categories in Highcharts? -

i using grouped categories library here https://github.com/blacklabel/grouped_categories . how retrieve parent category? example, how get/return category "fruit" graph here: http://blacklabel.github.io/grouped_categories/ . have tried this.x returns both parent , subcategories of point. this.category.name return subcategory, or "apple" in example. you got it. talking tooltip, can reach parent category name this.x.parent.name . looks can parent level way; try it: jsfiddle

python - tkinter create_window erases previous window -

for reason, when go create_window in tkinter canvas, erases in said window, , jams window in top left corner (even though set somewhere else. canvas.create_window(30, height - 40, anchor = nw, width = 40, window = canvas.data.buildsquarebutton) precedes canvas.create_rectangle(0,0,width, 40, fill = "#888888888", outline = "#888888888") canvas.create_rectangle(0, height, width, (height-40), fill = "#888888888", outline = "#888888888") canvas.create_rectangle(0, 40, width, (height - 40), fill = "#fffffffff", outline = "#fffffffff") and image. i put in 1 second time.sleep after create_window, , see button put in right place. after time.sleep over, button threw in top right corner , rectangle never appeared. commented out window, , rectangles appeared fine. am doing wrong when call window, or there tkinter glitch? there's not e

apache - .htaccess rewrite rule for replace space with hyphen in a url -

mysite.com/details/42/site title or mysite.com/details/42/site%20title the following rewrite rule generates above url rewriteengine on rewriterule ^details/([0-9]+)/?([a-za-z0-9_-\s]+)/?$ /detail.php?id1=$1&id2=$2 how can change url mysite.com/details/42/site-title how can replace spaces hiphen(-) in url, please help assuming never have hyphens in "site title", can add this: rewritecond %{query_string} ^(.*)&id2=([^&]+)(%20|\+)(.+)$ rewriterule ^detail.php$ /detail.php?%1&id2=%2-%4 [l]

passing a get parameter in django named variable -

my url patterns defined in django - url(r'^import-contacts$', 'import_contacts', name='import_contacts'), the view expects parameter, parse in view , process it, url should of format - http://127.0.0.1:8000/import-contact/?service=google in template following - <a href="{% url "import_contacts" %}"> text here </a> this generate following url - http://127.0.0.1:8000/import-contact/ , not url reqd. any idea on how pass variables named url params. just add after tag: <a href="{% url "import_contacts" %}?service=google">

javascript - angularjs controller executes 2 times -

i have problem controller executes twice, yet not have duplicates can see (even running case sensitive search through files shows 1 in route configuration , actual controller). route config: $routeprovider.when('/cb159e1ec61d0613f10ab397d8bd6782',{ templateurl: view+'passwordreset.html', controller:'passwordreset' }); controller: app.controller('passwordreset',['$scope','$http', function($scope,$http){ $scope.token='asdf' console.log($scope.token); // <-- logs 2x console }]); passwordreset.html : <div class="row"> <div class="small-12 columns"> <fieldset class="content-box"> password reset {{token}} </fieldset> </div> </div> also, i've created new route , tried, still logs twice. i've cleared cache well. controllers execute once, twice (i put alert in few controllers, show o

shell - is there a way to check if a bash script is complete or not? -

i'm trying implement repl (read-eval-print loop) in bash. if such thing exists, please ignore following , answer question pointer it. let's use script example (name test.sh ): if true echo else echo b fi echo c what want read script line line, check if have read far complete bash expression; if complete, eval it; otherwise keep on reading next line. script below illustrates idea (it not quite work, though). x="" while read -r line x=$x$'\n'$line # concatenate \n # line below bad way go if eval $x 2>/dev/null; eval $x # code seems working, eval x="" # empty x, , start collecting code again else echo 'incomplete expression' fi done < test.sh motivation for bash script, want parse syntactically complete expressions, evaluate each expression, capture output, , mark source code , output (say, using markdown/html/latex/...). example, script echo echo b what want achieve output this: ```bash

css - Get content of tiny mce with many textareas on page -

var inst, contents = new object(); (inst in tinymce.editors) { if (tinymce.editors[inst].getcontent) contents[inst] = tinymce.editors[inst].getcontent(); i have 3 textareas on page 3 different id: #id1; #id2;#id3. how can make work code #id3? i've tried replace inst id3, didn't work. it suffiecient call var contents = new object(); (var = 0; < tinymce.editors.length; i++) { contents[i] = tinymce.editors[i].getcontent(); }

jquery - calculating <col> width in chrome -

has found reliable way calculate width of <col> element in chrome? i writing jquery plugin need calculate widths of table columns, , using <col> reliable way both , set widths. problem cant read them in chrome. here fiddle not impossible find out width of 2nd column in chrome: http://jsfiddle.net/n3yef/4/ my challenge: find width of 2nd column in chrome without having append row table. edit : crux this: elements 'display' set 'table-column' or 'table-column-group' not rendered (exactly if had 'display: none'), useful, because may have attributes induce style columns represent. (from http://www.w3.org/tr/css2/tables.html ) this isn't want, here fiddle calculates column width: http://jsfiddle.net/jvhuv/1/ as far can tell, <col> elements have no size since not rendered elements. size of column, need measure actual <td> or <th> elements in table.

android - Keep ActionBar from reverting changes -

i'm using activity webview , keep refreshing whenever device rotated, have android:configchanges="orientation|screensize" in androidmanifest.xml. problem whenever device rotated, changes have made status bar dissapear. know how keep webview refreshing whenever rotated , keep changes i've made in status bar? this method use make changes statusbar public static void changeactionbarfont(activity activity) { typeface slab = typeface.createfromasset(activity.getassets(), "robotoslab.ttf"); int actionbartitle = resources.getsystem().getidentifier( "action_bar_title", "id", "android"); int actionbarsubtitle = resources.getsystem().getidentifier( "action_bar_subtitle", "id", "android"); if (0 == actionbartitle & 0 == actionbarsubtitle) { actionbartitle = com.actionbarsherlock.r.id.abs__action_bar_title;

ios - UIImage loaded from URL in Xamarin / C# -

it has been 4 years since this question has been answered this blog post . is there standard way create uiimage image url? like: uiimage image = uiimage.fromfile("http://foo.com/bar.jpg"); i feel i'm missing simple. not one-liner, few lines can roll own. e.g. static uiimage fromurl (string uri) { using (var url = new nsurl (uri)) using (var data = nsdata.fromurl (url)) return uiimage.loadfromdata (data); } the calls, including 1 uiimage , thread-safe.

python - Read 4 lines at a time -

i trying read fastq file 4 lines @ time. there several lines in file. when put in code, this: traceback (most recent call last): file "fastq.py", line 11, in line1 = fastq_file.readline() attributeerror: 'str' object has no attribute 'readline' this code: import tkinter, tkfiledialog #asks user select file root = tkinter.tk() root.withdraw() fastq_file = tkfiledialog.askopenfilename() if fastq_file.endswith('.fastq'): #check file extension minq = raw_input("what minimum q value? must numerical value.") #receives minimum q value while true: line1 = fastq_file.readline() if not line1:break line2 = fastq_file.readline(2) line3 = fastq_file.readline(3) line4 = fastq_file.readline(4) txt = open(practice.text) txt.write(line1) #puts lines file txt.write("\n") txt.write(line2) txt.write("\n") txt.write(line3) txt.wri

Calling Java class's method from javascript in a freemarker template -

i have freemarker template javascript in it, , i'm using spring mvc pass in java object "emailer". somehow, in freemarker template, want call emailer object's "sendemail(params, ..)" method javascript within freemarker template. know how call java methods freemarker (the regular way - example: how call java methods on object freemarker template? ) , don't know how within javascript . is possible? if so, how? , if it's not, alternatives? the overall goal value dropdown list (using javascript), , using value in java method gets called when button pressed. thanks in advance! if more info needed, i'd happy provide it. it's not possible combination of how these technologies work together, in usual flow of things, you're looking forward wouldn't possible: a java call (mediated spring ) renders freemarker , allowing calls java code processes. this rendered string (which might happen contain javascript ) shipped

google app engine - Creating a channel for webRTC video chat -

i've been following html5rocks webrtc guide , have javascript set described, guide not clear on how receive channeltoken, roomkey, , user id. guide says, "note values used in javascript, such room variable , token used openchannel(), provided google app engine app itself: take @ index.html template in repository see values added." unfortunately link provided no , i'm left little information regarding essential step in process. guide isn't clear whether or not google app engine necessary component , don't see why should be. have searched web in attempt find more useful source, unsuccessful. took @ webrtc demo(https://apprtc.appspot[dot]com), no seeing channel information generated server side. feel should able make simple http request google server , run there. information regarding problem appreciated. apologies: code example has been moved here . (been meaning update article, haven't had chance...) the apprtc.appspot examp

asp.net - Using an ASP:textbox as a <textarea> -

i'm using asp textbox textarea, recognize rendered html input type=text. has thusfar served intended purpose, exception cannot wrap or start @ top. here html: <asp:textbox id="message_box" form="feedback_form" cssclass="contact_input" maxlength="1200" lines="10" cols="10" wrap="true" mode="multiline" runat="server"/> and css: #main_box_left form textarea, #main_box_left form .contact_input { margin:0; padding:5px; height:228px; width:453px; max-width:455px; max-height:230px; min-height:230px; font-size:13px; line-height:20px; color:rgb(63,69,73); font-family:arapey; font-weight:lighter; min-width:455px; margin-top:10px; background-color:#fcfcfc; border:1px solid #a9a9a9; border-top:1px solid #191919; border-left:1px solid #191919; } the "lines", "cols" , "wrap" tags in asp component seemingly nothing. if there alternative tag should usi

html - Input button moving on page refresh? -

i have login form , have custom image button. reason, if page refreshed or reloaded, moved down line , mess formatting. if page refreshed again, goes normal. happens on , on again. have no idea causing it. anyway, here form , css it. labeled value=login. entire form in class "login_box. login form code: <form action="process.php" method="post"> <input type="text" placeholder="username" name="user" maxlength="30" size="16px" value="<?php echo $form->value("user"); ?>"></td><td><?php echo $form->error("user"); ?></td></tr> <input type="password" placeholder="password" name="pass" maxlength="30" size="15px" value="<?php echo $form->value("pass"); ?>"></td><td><?php echo $

c# - Throwing ExternalException with custom HResult -

i wanted throw exception custom hresult or errorcode have tried externalexception code throw new externalexception("login required", 0x6acfc5); however when catch exception , it's hresult , find not 0x6acfc5 strange negative number. externalexception("login required", 0x6acfc5) this constructor accept errorcode second parameter, , in system.int32 when give value 0x6acfc5 convert int value 7000005 , that's see hresult if call ex.hresult.tostring("x") 6acfc5 note: tostring("x") convert int value hexadecimal string

ruby on rails - Do not deserialize ActiveRecord YAML.load-ing -

given yaml content similar to: --- :template: :project_change :property: !ruby/activerecord:property attributes: id: '99' name: lorem ipsum 1 dolorem - 101 status: available how make sure there no queries db when deserialising content? any activerecord values can ignored, instead of being returned. the (ugly) workaround found this: yaml.load(yaml_content.gsub(/(!.+activerecord.+)/, '')) which convert yaml above to: --- :template: :project_change :property: attributes: id: '99' name: lorem ipsum 1 dolorem - 101 status: available meaning activerecord entry becomes regular hash. this ugly , if tell don't want activerecord classes returned. using ruby 1.9/2, rails 3.2, recent versions of other gems.

why do most file formats define a start of file marker? -

for instance jpeg (jfif) has soi (start of image) marker. 1 can argue can used identify type of file, i'm looking more sound reason supporting examples. these referred "signature bytes" , primary purpose aide in validating file. file types contain additional signature bytes elsewhere in file (ie: bmp format), , contain none @ all. latter kind still provide other means validate file using variety of techniques, such checksums, stored file size , like.

Adding bullets to Jquery - Jquery closest -

i have following code: $('.add-bullet').click(function() { $(this).closest('textarea').val( $(this).closest('textarea').val() + '\u2022' ); return false; }); <div><a href = "#" class = "add-bullet">add bullet</a></div> <textarea name =""></textarea> for reason, when click on add bullet, not adding textarea, meaning closest not working. can do? likely scoping problem "this". you want pass onclick event in function, like $('.add-bullet').click(function(e) { $(e.target).closest('textarea').val( $(e.target).closest('textarea').val() + '\u2022' ); return false; }); try that.

int() conversion of float in python -

i conversting float integer in below code. , resultant output not correct nickels. code: actual = 25 paid = 26.65 cents = (paid-actual)*100 quarters = int(cents/25) cents = cents %25 dimes = int(cents/10) cents = cents %10 nickels = int(cents/5) print quarters, dimes, nickels,cents print 5.0/5,int(5.0/5) ouput: 6 1 0 5.0 1.0 1 expected output 6 1 1 5.0 1.0 1 if explicitly int(5.0/5) 1 , when same done assigned variable in code, 0 . not sure why. can explain ? floating point numbers not guaranteed spot on number expect, barely off, 5.0 might 4.999... , since int() truncates/rounds down, error. many banks give on floating point issue , work $1.00 = 100 advise same, this: actual = 25 paid = 26.65 cents = int(round(paid*100)) #turns 26.65 2665 before float math dollars = cents / 100 cents %= 100 quarters = cents / 25 cents %= 25 dimes = cents / 10 cents %= 10 nickels = cents / 5 print quarters, dimes, nickels,cents print 5.0/5,int(5.0/5) note outputs 2

Popup window in grails -

i have text area , button. when button click popup window should display, list of text. how can accomplish this? tried use modalbox plugin , when action called not getting text area input. i tried this. there other solution popup or there's work around in modalbox plugin? <modalbox:createlink controller="mgexecutinggroup" action="addeg_create" id="600001" title="add executing group" width="800"><g:actionsubmit name="createadd" action="addeg_create" value=" + " /> </modalbox:createlink> from code, found if called action modalbox, should return value of text area. in case link dont see haven't passed textarea value action. if want use modal box plugin work around how pass text value action using modal box. otherwise can use use twiiter bootstrap modal easy use. can see more details in following link twitter bootstrap many modal demos using twitter bootstrap avail

java - Read and split text file into an array - Android -

i have gone through loads of these questions still cant seem figure out. have text file split rows. each row consists of 5 pieces of data separated ",". trying read file , split information string array in form: string [][] xyz = new string [5][100]; please me out simple solution!? thanks!!! :) data example: john,22,1953,japan,green anna,18,2012,mexico,blue sam,34,1976,san francisco,pink sample code: public void readfile(){ assetmanager manger; string line = null; try { manger = getassets(); inputstream = manger.open("data.txt"); inputstreamreader isr = new inputstreamreader(is); bufferedreader br = new bufferedreader(isr); while ((line = br.readline()) != null) { values.add(line.split(",")); //system.out.print(value); } br.close(); string[] array = values.toarray(new string[20]; } catch (ioexception e1) { toast.maketext(

osx - Connection Qt with cooca -

i work on qt. want create connection cocoa qt in qt project. in connection how import coca framework i.e imageio framework. exist in path /system/library/frameworks/applicationservices.framework/frameworks/imageio.framework. if apply stament #import ,this statement through error imagio/imageo.h : no such file or directory. in framework access cgimagedestnationcreatewithurl function. to include osx framework, add .pro file. example, include core foundation libraries you'd add: - qmake_lflags += -f /system/library/frameworks/corefoundation.framework/ libs += -framework corefoundation therefore, imageio framework be:- qmake_lflags += -f /system/library/frameworks/applicationservices.framework/frameworks/imageio.framework libs += -framework imageio it may need add path applicationservices.framework, if includes imageio, if not, add full path.

jsf - Audit Log In portal -

i have asked similar quesiton observer pattern suggestion ,i have implement audit log portal have make entry in db feature user accessign can go lot dipper in short of action of user has audited captured in db. i came across portlet filter , can suggested if can interceptor kinf of concept portal or portlert filter. i using websphere portal , jsr286 , jsf1.2 yes, portlet filter should suit requirement. can create single filter , access portal state information request gather kind of request made. way can apply same filter across portlets, record kind of request made in each case. remember need configure filter each portlet, , apply specific life cycle phases. see: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2fcom.ibm.websphere.express.doc%2finfo%2fexp%2fae%2fcport_portlet_filters.html

javascript - How to call a function on body load -

hi using script add social media icon site. <div id="menu" class="shareselector" style="width:250px; height:250px;"></div> $(document).ready(function () { $('.shareselector').socialshare({ social: 'facebook,google,pinterest,twitter', whenselect: true, selectcontainer: '.shareselector' }); }); div gets content upon clicking on it.can call function without clicking div means on bodyload? regards:ali the $(document).ready(function () {}); function should run when page loads. have got jquery in <script> tag? if so, bindings setup socialshare plugin, may need @ that. what whenselect option do?

fortran - Fortran95 -- Reading from a formatted text file -

i need read values table. these first 5 rows, give idea of should like: 1 + 3 98 96 1 2 + 337 2799 2463 1 3 + 2801 3733 933 1 4 + 3734 5020 1287 1 5 + 5234 5530 297 1 my interest in first 4 columns of each row. need read these arrays. used following code: program ---- implicit none integer, parameter :: totbases = 4639675, totgenes = 4395 integer :: codtot, ks integer, dimension(totgenes) :: ngene, lend, rend character :: genome*4639675, sign*4 open(1,file='e_coli_g_info') open(2,file='e_coli_g_str') ks = 1, totgenes read(1,100) ngene(ks),sign(ks:ks),lend(ks), rend(ks) end 100 format(1x,i4,8x,a1, 2(5x,i7), 22x) ks = 1, 100 write(*,*) ngene(ks), sign(ks:ks),lend(ks), rend(ks) end end program the loop @ end of program print first hundred entries test being read

Generating a list of random words in Excel, but no duplicates -

i'm trying generate words in column b list of given words in column a . right code in excel vba this: function gettext() dim givenwords givenwords = sheets(1).range(sheets(1).[a1], sheets(1).[a20]) gettext = a(application.randbetween(1, ubound(a)), 1) end function this generates word list have provided in a1:a20 , i don't want duplicates . gettext() run 15 times in column b b1:b15 . how can check duplicates in column b, or more efficiently, remove words temporarily list once has been used? for example, select range a1:a20 select 1 value randomly (e.g a5 ) a5 in column b1 select range a1:a4 , a6:a20 select 1 value randomly (e.g a7 ) a7 in column b2 repeat, etc. this trickier thought. formula should used vertical array eg. select cells want output, press f2 type =gettext(a1:a20) , press ctrl+shift+enter this means can select input words in worksheet, , output can upto long list of inputs, @ point you'll start getting #n/a

.htaccess - How to 410 all urls with .html extension in htaccess -

i want 410 urls .html extension. say xx.html, yy.html (all .html). how acheive htacess rewrite or redirect 410 rules? http status 410 means "gone", can accomplished [g] flag in mod_rewrite. rewriterule \.html$ - [g] see documentation g flag , documentation mod_rewrite .

matlab - get integer representation of .SPH audio files -

i trying train neural network using audio files in .sph format. need integers represent amplitude of sound waves neural net, used sox convert files .wav format calling sox infile.sph outfile.wav remix 1-2 (remix converting 2 channels 1), , tried use [y, fs, nbits, opts] = wavread('outfile.wav') in matlab integer representation. however, matlab threw data compression format (ccitt mu-law) not supported. used sox infile.sph -b 16 -e signed-integer -c 1 outfile.wav think puts wave file in linear format instead of mu-law. matlab threw error: invalid wave file. reason: cannot open file. my audio files in 8000 hz u-law single or dual channels, , in 8-bit, think (8-bit single sure). is there way integer representation out of audio files using matlab or other programs? either u-law or linear fine, unless 1 better neural net training. preferably 8 bit, since source files in 8-bit. i don't understand .sph. uncompressed ones (and ignore headers), files storing amplit

Application Icon and Tile sizes for apps which works on windows phone 7.1, WP7.8 and WP8.0 -

i'm jus confused application icon sizes need used wp. app works on three, 7.1 , 7.8 , 8.0. use windows phone 8 sdk. this link gives sizes need. question in wmappmanifest.xml file, since app supports three, app icon 1 give? 66x66 or 99x99. tile 1 need give? app icon same app list icon. when create new wp8 project, applicationicon of size 100x100? when size mentioned 99x99. which default tile size need give app work in both 3 versions? if app targets phone 7.1 (which can used on 7.1, 7.8 , 8) need normal icons (applicationicon.png , background.png). if want support new tiles in 7.8 , 8 check out this blog windows phone dev team. msdn article , handy helper .

version control - SVN Update not working in Tortoise -

i having problems svn update menu ooption in tortoise svn i.e. window appears saying completed nothing appears of happened i.e. working copy has not reverted previous committed version. commit option works ok. i have read questions this: tortoise svn update , commit doesn't work , have not yet found solution. use "update revision" update working copy specific revision, if want revert changes in repository, check "undoing changes" section.

vb.net - vb (output is doubling in Richtextbox field) -

using vb in visual studio 2012. can't figure out how clear whatever need clear. see code i'm using below: private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click if richtextbox1.text > "" pingproc.canceloutputread() 'need clearing code here richtextbox1.text = "" end if me.height = 522 pingproc.startinfo .filename = "cmd.exe" .arguments = "/c c:\tracert.bat" .redirectstandardinput = true .redirectstandardoutput = true .useshellexecute = false .createnowindow = true end addhandler pingproc.outputdatareceived, addressof handleprocessoutput pingproc.start() pingproc.beginoutputreadline() end sub private sub handleprocessoutput(byval sender object, byval e system.diagnostics.datareceivedeventargs) me.invoke(new delegateaddtext(addressof addtext), new object() {e.data}) e

java - I want to design hurdles like used in jetpack joyride -

how can design hurdle pattern going easy tough magical ride(facebook), jetpack joy ride etc. able design separately want more optimize way this. for(int i=0;i<5;i++) { for(int j=0;j<i;j++) { system.out.println(j); } } this give me triangle shape want more complex design there other way it. well better approch make 2d array int[][] coinmatrix1 = { { 1, 0, 0, 1, 0, 0 }, { 0, 1, 0, 0, 1, 0 }, { 0, 0, 1, 0, 0, 1 }, { 0, 1, 0, 0, 1, 0 }, { 1, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, }; generatecoinmatrix(coinmatrix1); public void generatecoinmatrix(int[][] coinmatrix2) { (int = 0; < 6; i++) { (int j = 0; j < 6; j++) { if (coinmatrix2[i][j] == 1) { coin = dummycoinscollection.get(countcoinfromdummy); coin.coineffectshow = false; // me coin

Writes in Netty 4.0.4.Final using the SimpleChannelInboundHandler does not work anymore -

i have upgraded netty lib 4.0.0.cr9 4.0.4.final yesterday discover interfaces has changed again. method messagereceived not exist anymore, or being replaced channelread0 method. in server-side app read json, bi, , @ end of method write json client. trying in channelread0 have following problem:- seem stuck in channelfuture.operationcomplete never gets called. goes operationcomplete once stopped/close client. use channel.writeandflush(...) or call channel.flush() explicitly . stated in release notes of 4.0.0.final.

c# - Parallel.ForEach stalled when integrated with BlockingCollection -

i adopted implementation of parallel/consumer based on code in this question class parallelconsumer<t> : idisposable { private readonly int _maxparallel; private readonly action<t> _action; private readonly taskfactory _factory = new taskfactory(); private cancellationtokensource _tokensource; private readonly blockingcollection<t> _entries = new blockingcollection<t>(); private task _task; public parallelconsumer(int maxparallel, action<t> action) { _maxparallel = maxparallel; _action = action; } public void start() { try { _tokensource = new cancellationtokensource(); _task = _factory.startnew( () => { parallel.foreach( _entries.getconsumingenumerable(), new paralleloptions { maxdegreeofparallelism = _maxparallel, cancellationtoken = _tokensource.

java - Modifying Eclipse EMF Editor New Child menu without changing providers -

i having problem modifying emf's automatically created "new child" menu create submenus kinds of items. found that, default, pipe symbol used separator, child object name hamburger | megaplusbig results in hamburger submenu appearing. this page seems suggest overriding getcreatechildtext() in relevant item provider option. what want types of model items appear in submenu, , achieve i'd make sure mysubmenu | gets prepended name. problem classes model i'm editing in eclipse in separate jar file can't (or rather shouldn't) modify. and have not had luck trying achieve in way. other attempt extending basicmodeleditactionprovider , overriding fillcontextmenu() , updateactions() methods. latter create submenus through call basicactionprovider.extractsubmenuactions() , again override, information model objects lost in abstraction. method works on iaction lists , if cast action staticselectioncommandaction (which is), command field has no public

encoding - Mantissa Normalization of C# double -

edit: got work now, while normalizing mantiss important first set implicit bit, when decoding implicit bit not have added. left marked answer correct, information there helped. i'm implementing encoding (distinguished encoding rules) , have slight problem encoding double values. so, can out sign, exponent , mantissa double in c# using: // parts double value = 10.0; long bits = bitconverter.doubletoint64bits(value); // note shift sign-extended, hence test against -1 not 1 bool negative = (bits < 0); int exponent = (int)((bits >> 52) & 0x7ffl); long mantissa = bits & 0xfffffffffffffl; (using code here ). these values can encoded , simple reversal of process me original double. however, der encoding rules specify mantissa should normalized: in canonical encoding rules , distinguished encoding rules normalization specified , mantissa (unless 0) needs repeatedly shifted until least significant bit 1. (see here in section 8.5.6.5 ). doi

c# - iTextSharp sign verify fails even if acrobat verify that sign without error -

i'm using itextsharp 5.4.2 , on sign acrobat verify correct , not corrupted sign sign not verified (here sample ). i debugged source code , found if rsadata in sign sha1 of content (20 bytes) messagedigest created sha256 , verifyrsadata = arrays.areequal(msgdigestbytes, rsadata) obiously fails. in opinion "error" in pdfpkcs7.cs @ line 335 the sign created filter /adobe.ppkms , subfilter /adbe.pkcs7.sha1 what's wrong ? take @ code fix ? thank domenico

Jquery Ajax Polling jumps to top on every call -

i using below function display active gamelist. problem if player going through list , if there executes ajax call jumps top of div replace response ajax call. how can avoid jumping of top of div? or other solution should implemented display list of latest games without jumping of on ajax call? (function pollserverforgamelist() { $.ajax({ url:"<?php echo yii::app()->createurl('game/getgamelist') ?>", data:{'id':<?php echo yii::app()->request->getparam('id')?>}, type:"post", datatype:"html", success:function(response){ $('.multiplayer').html(response); }, }); settimeout(pollserverforgamelist, 2000); }()); single row response data , button join game. <ul> <li class="first">math</li> <li>rookie</li> <li>guest11</

c++ - how to block and wake a boost thread? -

how can block boost thread , wake thread? thread doing work, if work finished should block or sleep, if new work ready main thread should weake worker thread. tried blocking read on boost ipc message_queue not performant solution. something this: void thread() { uint8_t ret=0; for(;;) //working loop { ret=dowork(); if(ret==work_complete) { blockorsleep(); } } } with pthreads can block on semaphore not platform independent. one solution problem condition variable , is, name implies, way of waiting in thread until condition reached. requires mutual co-operation between threads. from example in documentation linked above: thread 1: boost::condition_variable cond; boost::mutex mut; bool data_ready; void process_data(); void wait_for_data_to_process() { boost::unique_lock<boost::mutex> lock(mut); while(!data_ready) { cond.wait(lock); } process_data(); } thread 2: void retrieve_data

css - Button size dont change according to the width size -

i have attempted use media query make website graphically nicer on tablet/smartphone. looked around , found common syntax adjust size via width of media. /*media query*/ @media screen , (max-device-width: 720px) { #homebutton input[type=image] { position: absolute; left: 0%; top: 0%; margin: 0px; height: 700px; } } based on understanding, if device width 720px , below, homebutton size enlarged 700px. however, despite testing on 2 of emulator each sizing 1024px , 480px. homebutton both emulators @ height of 700px. i have added important thing <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> here jsfiddle . pardon me if made mistake i'm not season-user on jsfiddle **update** check jsfiddle , add css in project , let me know concern http://jsfiddle.net/arunberti/jnzel/ here standard media queries used in site: hope helps you @media screen , (max-wid

ios - UITableView loading section before particular section -

i trying show calendar uitableview . each section corresponds each year of calendar , every section contains 12 cells correspond 12 months. i trying show 10 years calendar, 5 years current date , 5 coming years. can load current year(section) 2013 section 0 in uitableview . when scroll table upward want see year 2012 above year 2013. 2013 section 0 cant though can insert new sections after current section simple. - (id)initwithframe:(cgrect)frame logic:(linekalmonthlogic *)thelogic delegate:(id<linekalviewdelegate>)thedelegate { frame.size.width = kklinetilesize.width; frame.size.height = 31 * kklinetilesize.height; if (self = [super initwithframe:frame]) { self.clipstobounds = yes; logic = [thelogic retain]; delegate = thedelegate; cgrect rect = cgrectmake(0, 0,1024, 716); _maintable =[[uitableview alloc] initwithframe:rect style:uitableviewstylegrouped]; _maintable.delegate = self; _maintable.datasource = self; _maintable.backgro

python - Convert user input strings to raw string literal to construct regular expression -

i know there posts convert string raw string literal, none of them situation. my problem is: say, example, want know whether pattern "\section" in text "abcd\sectiondefghi". of course, can this: import re motif = r"\\section" txt = r"abcd\sectiondefghi" pattern = re.compile(motif) print pattern.findall(txt) that give me want. however, each time want find new pattern in new text, have change code painful. therefore, want write more flexible, (test.py): import re import sys motif = sys.argv[1] txt = sys.argv[2] pattern = re.compile(motif) print pattern.findall(txt) then, want run in terminal this: python test.py \\section abcd\sectiondefghi however, not work (i hate use \\\\section ). so, there way of converting user input (either terminal or file) python raw string? or there better way of doing regular expression pattern compilation user input? thank much. use re.escape() make sure input text treated literal tex

When Wifi disconnect, how does Socket on Android server side know that? -

i developed android app, works in wifi ap mode socket server. clients setup wifi connection , socket connection app. when socket connected, disconnect wifi connection client, there no exception nor read method of socket return -1 in server app. questions are: how detect broken wifi connection how detect client's wifi connection broken thanks. use in thread public static boolean checknetworkconnection(context context) { final connectivitymanager connmgr = (connectivitymanager)context.getsystemservice(context.connectivity_service); final android.net.networkinfo wifi =connmgr.getnetworkinfo(connectivitymanager.type_wifi); final android.net.networkinfo mobile =connmgr.getnetworkinfo(connectivitymanager.type_mobile); if(wifi.isavailable()||mobile.isavailable()) return true; else return false; }

javascript - Ember routes specifying a different root url -

i've application running on wamp server. directory structure looks wamp/www/applicationliveshere i've ember application within same directory , it's structure looks wamp/www/emberapp/applicationliveshere i've set php project using rest can access data using eg. http:localhost/emberapp/videos return videos in database json client. problem in ember i'm unsure how set routes use localhost/emberapp/videos. each time load page controller using localhost/videos , returning 404 not found. using 'ember-data.js' handle models. , have created store follows videos.store = ds.store.extend({ revision: 12, url: "http://localhost/emberapp/"}) my videos route defined videos.videosroute = ember.route.extend({ model: function(){ return videos.video.find(); } }); i have path set follows videos.router.map(function({ this.resource('videos', {path: '/'}); }); so clarify want routes begin http://localhost/emberapp/..... @ mo

java - Hibernate updating Null Values to dynamic updatable table -

here problem facing. i have table not-null field create_date. dont want update particular column when update done in table. gave dynamic-insert="true" dynamic-update="true" in table hbm.xml. problem getting error trying update null not-null field though not modifying object. pasting code here. if (userdo.getuserid() != null) { if(sessionmanager.getinstance().currentsession() != null){ getsession().evict(userdo); getsession().clear(); } getsession().update(userdo); //getsession().saveorupdate(userdo); } in domain class above field don't want store null set: @column (nullable = false)

google app engine - GAE & datastore - filter and delete entities with python -

i'm trying delete datastore table entities have type field value equals "test". actually table structure this: table test id | type | value --------------------------------- 1 | test | aksjdh 2 | foo | wer 3 | test | gg 4 | test | werqwer 5 | bar | akvcvcxjdh i'm able delete entities piece of python code, called via url request: import cgi import datetime import urllib import webapp2 google.appengine.ext import db class test(db.model): id = db.stringproperty() type = db.stringproperty() value = db.stringproperty() class testhandler(webapp2.requesthandler): def get(self): ... db.delete(test.all()) app = webapp2.wsgiapplication([ ('/deletetest', testhandler) ], debug=true) what i'd know is: in previous code, delete test's entities, i've used method all() of test's class, have use same logic delete subset of e

javascript - textbox access for datepicker -

i'm using date picker jquery plugin created stefan petre , available here: http://www.eyecon.ro/datepicker/#about this code i'm using apply datepicker textboxes $('.tablemstcellecd').datepicker({ format: 'd/m/y', date: $('.tablemstcellecd').val(), current: $('.tablemstcellecd').val(), calendars: 3, onchange: function (formated, dates) { $('.tablemstcellecd').val(formated); $('.tablemstcellecd').datepickerhide(); } }); it works fine, updates values of textboxes instead of selected one. problem there can different number of texboxes cannot hard code access values. trying implement "this" keyword somewhere command did not succeed i agree deepanshu, should use jquery ui. if want avoid reason, karelg's solution works fine, since include jquery, can write that: $('.tablemstcellecd'

variables - iMacros - set a loop based on number of products -

i trying scrape information multiple pages in site using imacros. need loop takes me through pages, header of each page displaying number of products on page - example - "1-20 of 260", "21-30 of 260",etc. initialize loop setting variable display on first page "1-20 of 260". how can write loop take set !loop value this("1-20 of 260")? please help. thanks, raoul loop in imacros using javascript here example of how can use if clauses, loops etc.. in imacros.

apache - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application -

i using jdk 1.7, apache tomcat 7.0.23 , have placed jstl core library(1.2) , standard jar in web_inf lib folder not giving me warning when try run code <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <!-- create bean instance--> <jsp:usebean id="listdomain" class="bean.populatemultidomain" scope="session"></jsp:usebean> <jsp:setproperty property="*" name="listdomain"/> <c:foreach var="item" items="${listdomain.status}"> <option> <c:out value="${item}" /> </option> </c:foreach> it gives me following error: org.apache.jasper.jasperexception: absolute uri: http://java.sun.com/jsp/jstl/core cannot resolved in either web.xml or jar files deployed application