Posts

Showing posts from September, 2012

linux - Is file object local to every process or System wide? -

as linux device driver developer in idea file object local structure every process , address available in fd table corresponding fd. when came across section 5.6 in linux programming interface michale kerrisk states that two different file descriptors refer same open file description share file offset value. therefore, if file offset changed via 1 file descriptor (as consequence of calls read(), write(), or lseek()), change visible through other file descriptor. applies both when 2 file descrip tors belong same process , when belong different processes. i befuddled...kindly 1 me improve understanding. each process have own file descriptor table, , each time file open() ed yields separate file description. there sanity there! the exception when file descriptor duplicated, either within process (via dup() ) or across processes (by 1 process fork() ing copy same fds, or passing file descriptor through unix domain socket). when happens, 2 descriptors end sha...

javascript - Replace certain last words typed with html in contenteditable div -

i'm trying replace keywords in content-editable div hyper-links on fly user typing. have working great first word type first splitting entire string " ", grabbing recent word , if it's 1 of keywords, find start index , end index in entire string do: range.setstart(mydiv.firstchild, startofwordindex); range.setend(mydiv.firstchild, endofwordindex); range.deletecontents(); range.insertnode(...); where node i'm inserting hyper-link i've created didn't type out here brevity's sake. my problem is, after node inserted, can no longer use mydiv.firstchild in setstart() method because new have new nodes in front of user typing. this first crack @ content-editable html i'm not sure how grab last node nor sure using start , end indices of word work there anyway since based on entire length of div contents. any appreciated. after sleep, got sorted out on own: heavily commented in case in can else. function replacelastwordwithlink(edi...

ruby on rails - How edit job in sidekiq queue? -

i have queue happened contain wrong parameters perform_async worker. don't want loose jobs, edit arguments succeed next time or on forced retry. is possible? sidekiq stores jobs in redis maybe try using gui redis (like http://redisdesktop.com/ ) find job need update, edit, save. can done in loop update multiple of them.

Python - FOR loop not writing correct values in nested dictionaries -

hopefully can me none of research has helped me. have simple dictionary: mydict = { 1: {1: 'foo'}, 2: {1: 'bar'} } i'm duplicating each of key / value pairs assigning new key values: nextkey = len(mydict) + 1 currkey in range(len(mydict)): mydict[nextkey] = mydict[currkey + 1] nextkey += 1 which give me mydict of: { 1: {1: 'foo'}, 2: {1: 'bar'}, 3: {1: 'foo'}, 4: {1: 'bar'}, } i want add new key value pair of existing nested dictionaries. keys each should '2' , values each should increase each nested dictionary: newvalue = 1 key in mydict: mydict[key][2] = newvalue newvalue += 1 i expecting: { 1: {1: 'foo', 2: 1}, 2: {1: 'bar', 2: 2}, 3: {1: 'foo', 2: 3}, 4: {1: 'bar', 2: 4}, } but giving me mydict of: { 1: {1: 'foo', 2: 3}, 2: {1: 'bar', 2: 4}, 3: {1: 'foo', 2: 3},...

android - Reading data in NFC phone, with NFC Reader -

in project, need send 9 digit number nfc reader via nfc phone. nfc reader should read data, , use in windows project. i have samsung note 3 nfc phone, , acr122l nfc reader. i've been searching it, couldn't find answer. how can send data ? there example, or sample cod? the easiest way use hce (host card emulation) on android device. https://developer.android.com/guide/topics/connectivity/nfc/hce.html nfc reader on windows "see" card, when tap phone. update1 regarding windows reader sample, have @ tutorial: http://the--semicolon.blogspot.fr/p/this-is-simple-way-to-restart-your.html and of course @ official doc acs: http://www.acs.com.hk/en/products/144/acr122l-visualvantage-serial-nfc-reader-with-lcd/

Flann index in OpenCV Java API -

how create flann index opencv in java? i trying knn search of feature descriptors. cannot find equivalent class in java api. or official java binding incomplete? the c++ class documented here: http://docs.opencv.org/2.4/modules/flann/doc/flann_fast_approximate_nearest_neighbor_search.html#flann-index to people have same question me : ended using javacv, seems closer c++ api.

android - The project 'My Application' may be using a version of Gradle that does not contain the method -

Image
i use android studio 2.1.1 . follow tutorial: http://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/ this file build.gradle : // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' compile 'com.android.support:cardview-v7:23.3.+' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: delete) { delete rootproject.builddir } then android studio notice: the project 'my application' may using version of gradle not contain method i can't build project. me resolve problem. remove line: compile 'com.android.support:cardview-v7:23.3.+' from project level build.gradle file , pa...

php - How to attach a Laravel blade view in mail -

i'm trying attach blade view when send mail. i'm using laravel 4. tried this: mail::send( "emails.clientemail", $data, function($message) use ($data,$template,$subject) { $message->to($data['email'], $data['name']) ->from($template['from'],$template['from_name']) ->subject($subject) ->attach(app_path().'/views/email.blade.php'); } ); but view email.blade.php in blade template , doesn't display html code. how should send , display html? as metioned can use attachdata , add rendered data like: $rendereddata = view('email')->render(); mail::send( "emails.clienteail", $data, function($message) use ($data,$template,$subject) { $message->to($data['email'], $data['name']) ->from($template['from'],$template['from_name']) ...

java - Referenced library not pushed -

i working on eclipse, project gets pushed referenced jar file not pushed. there used message comes saying pushed no longer showing how can push referenced library check .gitignore file. i guess .gitignore don't allow push *.jar file(s) github repository.(everyone this. best practice don't commit/push jar file,use maven or gradle build system/dependency manager)

php - Pass variable from one function to another inside a single controller -

i'm trying pass variable within function next function called can error variable isn't defined. public function postpayment(request $request) { //fetch package name $package = $request->input('package'); //record order return $this->recordorder()->with('package', $package); } public function recordorder($package){ $stripe_trans = user::where('id', auth::user()->id)->pluck('stripe_id'); $order = new orders; $order->user_id = auth::user()->id; $order->order_id = $stripe_trans; $order->status = 'pending'; $order->save(); return redirect()->back(); } you have pass variable while calling fucntion return $this->recordorder($package);

mysql - full text search excluding a specific criteria -

i have table called items , enabled full text searching on name column id name price ---- ------ ------- 1 brown wood 550 2 black wood 430 3 wooden chair 15 4 kitchen knife 3 5 sponge ball 1.35 i want write query select items whom name doesn't include 'wood' using full text search so result be id name price ---- ------ ------- 4 kitchen knife 3 5 sponge ball 1.35 here query select * items match(name) against('-wood' in boolean mode); if don't want wood , fist stab @ query be: select * items match(name) against('-wood*' in boolean mode); however, - works after other terms matched. so, need sort of positive match. like: select * items match(name) against('k* , -wood*' in boolean mode); if know such exclusions common, might incl...

how to increment and decrement date in asp.net -

how increment , decrement date in asp.net.. i have tried following code.. or there alternative javascript..? { string dt; protected void page_load(object sender, eventargs e) { dt = datetime.now.toshortdatestring().tostring(); date.text = dt; } protected void decr_click(object sender, eventargs e) { date.text = convert.todatetime(date.text).adddays(-1).toshortdatestring().tostring(); } protected void incr_click(object sender, eventargs e) { date.text =convert.todatetime(date.text).adddays(1).toshortdatestring().tostring(); } wrap code of page_load event in if (!page.ispostback) protected void page_load(object sender, eventargs e) { if (!page.ispostback) { dt = datetime.now.toshortdatestring().tostring(); date.text = dt; } }

python - Mass insert with Redis fails with strange errors -

i playing redis mass import using pipe , have following python script: mydata = "" mydata += "*4\r\n$4\r\nhset\r\n$%d\r\n%s\r\n$%d\r\n%s\r\n$%d\r\n%s\r\n" % (len('myhash'), 'myhash', len('myfield'), 'myfield', len('myvalue'), 'myvalue') print mydata.rstrip() it produces: $ python redis_test.py *4 $4 hset $6 myhash $7 myfield $7 myvalue output of piping: $ python redis_test.py | redis-cli -h rnode -n 5 --pipe --pipe-timeout 1 data transferred. waiting last reply... err unknown command '2' err unknown command '$4' err wrong number of arguments 'echo' command err unknown command '$20' err unknown command '�˛�Æ©a\m���pm��x�[�' no replies 1 seconds: exiting. errors: 6, replies: 6 although getting populate db, know what's causing errors? rnode:6379[5]> keys * 1) "myhash" rnode:6379[5]> hgetall myhash 1) "myfield" 2) "myvalue" ...

html - CSS prevent from resizing at a point? -

hi making website , trying make width of object not overscale, i.e have body tag , set page width 60% , fine , trying set min width of xx% elements not go on each other , trying stop browser going on xx% , show content on page. i hope understands trying , me this. thanks .example{ max-width: 60%; } .example{ min-width:60%; } you mean max-width , min-width ? .wrapper { min-width: 50em; /* overrides max-width */ width: 100%; max-width: 20em; /* @ 20em wide */ }

php - Disable or enable checkbox, based on value in table -

if $partner has value no, want disable checkbox checkpartner if $partner has value yes, want enable checkbox checkpartner grtz benny <?php $result3 = mysqli_query($con,"select partner, vip event eventid = ".$row['eventid']." "); while($row = mysqli_fetch_array($result, mysql_both)) $partner = $row['partner']; if ($partner = 'no') { } ?> <form action="" method="post" name="registerform1" id="registerform1"> <h6>partner :<input type="checkbox" name="checkpartner"/> you'll have add attribute 'disabled' html-element 'input'. based on condition - in case - this. <?php // inside while-loop $disabled = ''; // default if ($partner == 'no') { // check do...

php - Laravel: simplest/right way to save a new step after login? -

i'm having first interaction core laravel code want careful not break anything. in project, users correspond person records (via user->person_id), have get_person_from_user() function takes \auth::user() (conveniently accessible anywhere) , returns person object, can grab person record authenticated user controller , pass view. the problem: there's piece of data person record i'd include in nav partial in default blade view (which gets extended bunch of different views), it's 1 case i'm not going through controller first. i'm unclear on how can make logged in user's person record available here. suggestions? i think need add step after user logs in, save person record (globally? in session?) it's accessible. login stuff happens in authenticatesusers.php, , reading around sounds i'll want add override of postlogin authcontroller. tried copying function authenticatesusers.php authcontroller (not adding else yet), , authcontroller gives...

PHP/MySQL Can't print column generated by query -

i'm trying build "top 15" results based on field called uid, works great except not printing count column in php, in phpmyadmin though. select * , count( uid ) count userreports group `uid` order count desc limit 15 here's returning array: ( [id] => 18 [date] => 2016-05-28 13:58:05 [name] => [uid] => [reason] => [staff] => patrick [count] => 2 ) ( [id] => 19 [date] => 2016-05-28 13:58:07 [name] => b [uid] => b [reason] => b [staff] => patrick [count] => 1 ) php code: if($result) { while($row = mysqli_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['uid'] . "</td>"; echo "<t...

I cannot display a javascript variable to a <p>? -

i don't know wrong code had reference of codes , done cannot display variable pharagraph? this code on script: <script type="text/javascript"> var myid = document.getelementbyid('myid').value; // var scope = 'global'; function testscope() { var scope = 'local'; function innerfunc() { return scope; } return innerfunc(); } var answer = testscope(); myid.innerhtml = answer; </script> on html <p id="myid"><!-- no variable displayed --></p> what doing wrong? use document.getelementbyid('myid') instead of document.getelementbyid('myid').value . because <p> element hasn't value property function checkfunctionscope() { var myid = document.getelementbyid('myid'); var scope = 'global'; function testscope() { var scope = ...

python - optional argument in template causing error when there is no argument -

here urls.py urlpatterns = [ url(r'^bankcreate/(?:(?p<info_id>[1-9]+)/)?$' , views.bankcreate , name='account-bankcreate'), ] i have url named account-bankcreate optional argument ... if argument passed view edit/update operation if not insert operation my view starts def bankcreate( requset , info_id = 0 ): errors = [] default = none if info_id not none , int(info_id) > 0 : try: default = bankaccounts.objects.get(id=info_id , user_id=requset.user.id) except bankaccounts.doesnotexist : default = none and works fine in template when i'm trying set form action <form method="post" action="{% url 'account-bankcreate' default.id %}"> if there no argument passed view error (it works fine when there argument): noreversematch @ /account/bankcreate/ reverse 'account-bankcreate' arguments '('',)' , keyword arguments '{}' no...

c# - Referencing Entity Framework in MVVM in layered architecture -

my app layered in 4 layers: core : put general , interface classes. model : code-first classes, , other related domain, such entity configurations , repositories etc. vm : view models live. referencing model . desktop : desktop app lives. referencing vm . i have installed entity framework model , viewmodel , desktop . my question is: enough install model only? why repeat again? [edit] here implementation of repository , unitofwrok ( irepository , repository on core ): public interface irepository<tentity> tentity : class { tentity get(int id); ienumerable<tentity> getall(); ienumerable<tentity> find(expression<func<tentity, bool>> predicate); tentity singleordefault(expression<func<tentity, bool>> predicate); void add(tentity entity); void addrange(ienumerable<tentity> entities); void remove(tentity entity); void removerange(ienumerable<tentity> entities); } public class reposi...

cordova - DEP0001 : Unexpected Error: -2147023436 While deploying Universal Windows App to Windows 10 Mobile -

Image
the error message severity code description project file line suppression state error dep0001 : unexpected error: -2147023436 what did i installed xamarin in visual studio 2015 , while installation took in latest updates. , on started facing errors, 1 after another. initial errors related somehow visual studio update 2 deleted deleting service named ipoverusbsvc but have managed solve problem downloading latest windows 10 sdk , running windows ip on usb-x86_en-us.msi installer. so, this question not issue, ipoverusbsvc , running. but facing new issue , no available on google. putting here, gets work around others help. my code running fine on local machine. facing error when trying deploy on phone. universal windows app built cordova. and visual studio configuration everything working fine till before update. any idea? anyone? [i find no way revert update. option seems uninstalling , reinstalling whole vs2015] :p edit / update 1 i turned radio ...

python - Merge rows in dataframe -

part of csv-file ('data.csv') have process, looks this: parent_id,parent_name,type,companyname,custsupid,streetaddress 3,customer,,,c0010, 3,customer,a,,, 3,customer,,ace systems,, 3,customer,,,,straat 10 7,customer,,,q8484, 7,customer,b,,, 7,customer,,xyz automat,, 7,customer,,,,laan 99 to import file dataframe do: df = pd.read_csv('data.csv').fillna('') this results in: ------------------------------------------------------------------ | |parent_id|parent_name|type|companyname|custsupid|streetaddress| ------------------------------------------------------------------ |0|3 |customer | | |c0010 | | |1|3 |customer |a | | | | |2|3 |customer | |ace systems| | | |3|3 |customer | | | |straat 10 | |4|7 |customer | | |q8484 | | |5|7 |customer |b | | ...

mongodb - Find documents with unique field -

i have collection of addresses geo field (lng/lat). want documents unique geo lng/lat pairs populate google map instance pins. naturally don't want multiple pins sitting in top of each other, need unique lng/lat pairs only. var mongoose = require("mongoose"), schema = mongoose.schema; var venueschema = new schema({ name: string, street: string, streetnumber: string, postcode: string, suburb: string, state: string, geo: array, // [lng, lat] }); var venue = mongoose.model('venue', venueschema); using distinct operator, can unique lng/lat. unfortunately query returns array of lng/lat geo points , not documents fields. have no idea business name belongs geo point. keystone.list('venue').model.find().distinct('geo') .exec(function(err, venues){ if(err){ throw err; } console.log(venues); // array of lat/lng pairs }); how construct query actual documents fields no 2 ge...

mysql - SQL values from two different tables -

okay have 2 tables in 1 database. 1 called accounts , 1 called settings . through one query fetch settings.positionx , settings.positiony , accounts.lastlogin . how go doing this? without knowing conditions want can guess.. here need do. if want records match in accounts , settings then: select settings.positionx, settings.positiony, accounts.lastlogin settings inner join accounts on settings.condition = accounts.condition if want records accounts (or settings) join matching records want left join / right join select settings.positionx, settings.positiony, accounts.lastlogin settings left join accounts on settings.condition = accounts.condition you can see visual representation of these joins here

java - unable to pass values from session variable for making pdf using iText and Struts2 -

here trying have made lists fetching values , storing in particular lists , since want access values in method creating session variable , passing values in session variable setting key , accessing in method using get(key) successful so.but want want make pdf in method using values in lists. unable so.below code , please me pass values making pdf. package com.ca.actions; import java.io.fileoutputstream; import java.sql.connection; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.util.arraylist; import java.util.list; import java.util.map; import org.apache.struts2.dispatcher.sessionmap; import org.apache.struts2.interceptor.sessionaware; import com.ca.database.database; import com.ca.pojo.event; import com.itextpdf.text.document; import com.itextpdf.text.element; import com.itextpdf.text.pagesize; import com.itextpdf.text.phrase; import com.itextpdf.text.pdf.pdfpcell; import com.itextpdf.text.pdf.pdfptable; import com.itex...

c - execl & printf - order -

i have small problem this: { printf ("abc"); execl("./prog","prog",null); } all works fine, why execl run before printf ? me? the printf run first, it's output buffered. you can flush buffer either adding newline ( \n ) end of string or calling fflush(stdout) : printf("abc\n"); or: printf("abc"); fflush(stdout);

php - How to process shortcodes with post_id outside `The Loop` -

i'm reading emails using postie . i'm using following filter process keywords inside email , convert them wp_postmeta items. my postie_post_before filter . //look ':keyword attribute:' tags , convert them '[keyword attribute]' function filter_content($post) { $content = $post['post_content']; $length = strlen($content); $pos = array( 'name' => strpos($content, ':name '), 'cost' => strpos($content, ':cost '), 'price' => strpos($content, ':price ') ); foreach ($pos $key => $value) { if (false !== $value) { $content[$value] = '['; $value = strpos($content, ':', $value+1); if ( (false !== $value) && (ctype_alnum($content[$value-1])) ) {$content[$value] = ']'; } } } //if there no name attribute steal subject line. if (strpos($content, '[name ...

python - TypeError: 'function' object is not subscriptable in sorting algorithm -

i creating program in python designed organise list, have been using insertion sort method, when execute program, after have input list top organise, returned error "typeerror: 'function' object not subscriptable" code below: def listsort(x): in range(1,len(list)): value = list[index] = index - 1 while i>=0: if value < list[i]: list[i+1] = list[i] list[i] = value = - 1 else: break please me understand have gone wrong here people, it's frying brain.... list() python function. you can't index functions. considering using different variable name. (like x since seems list trying sort) it's worth noting sort() , sorted() functions may use, learning sorting methods practice.

angular - Share API Data with child Component -

i pulling data api using service in angular 2 rc1.. gets pulled main component share data other components children of main template.. have made attempt inputs think using them incorrectly can steer me right direction on here.. @ moment making call api in both main , child component --- main component import {component} '@angular/core'; import {projectsmainapi} "../../../services/projects-main"; import { routeconfig, routeparams, router_directives, router_providers } '@angular/router-deprecated'; import {projectmetainfocomponent} "./projectmetainfocomponent"; declare var jquery: any; interface projectresult { project: object } @component({ selector: 'projects', templateurl: './app/components/projects/details/project-single.html', directives: [router_directives, proj...

c# - ASP_Merge resulting dll Default Namespace -

i'm trying merge aspx , ascx in single dll asp_merge.exe... working, , did create dll. problem is, merger creates default namespace name "asp" , inside compiled ascx , aspx. what need change "asp" namespace "mycustomnamespace". there way this? thanks in advance. when publish web application, compiles code single dll anyway. see how publish website .

java - A single line of code destroyed my project. How to repair? -

Image
so before, androidmanifest.xml had part : ... <application android:allowbackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/apptheme" > <activity ... and added line. ... <application android:allowbackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/apptheme" android:datepickerdialog="@style/customdialogtheme" > <activity ... after pressed run butten, many errors appeared. how looks : (link) if try delete line , run again, android studio undo delete , show same errors. do? android:datepickerdialog not property of <application /> . remove line of code , find right place. in style xml.

multithreading - Java thread join 3 -

Image
the program creates thread t0 spawns thread t1 , subsequently threads t2 , t3 created.after execution of thread t3 and application never returns other threads spawned earlier(t0,t1,t2) , left stuck. why threads t0 , t1 , , t2 suspended? public class cult extends thread { private string[] names = {"t1", "t2", "t3"}; static int count = 0; public void run() { for(int = 0; < 100; i++) { if(i == 5 && count < 3) { thread t = new cult(names[count++]); t.start(); try{ thread.currentthread().join(); } catch(interruptedexception e) { e.printsta...

How to set Splash on Java in such a way that it's exist still after build? -

i use netbeans java development. tried set splash project did following steps: right click on project>properties>run vm options: -splash:src/assests/images/splash.gif files>myproject>menifist: added: splashsceen-image: assests/images/splash.gif;**- while run project shows splash, works perfectly. but problem when build project , run program dist folder splash not appears, directly main gui runs. what might solution?

objective c - How to call drawRect: method in super view from subview? -

Image
i showing popover custom view this: and when user taps on popover must draw on custom view (from popover shown). i try make [mypopover.view.superview setneedsdisplay]; don't work. may can try more reload super view or call in drawrect: method? thank you! maybe this? [mypopover.superview drawrect:]

cocoa - How to allow only one window in GUI in Swift -

i connected menu-object window controller . calling window controller , i've added shortcut. on pressing shortcut multiple times, multiple windows opened. how call function, counts number of windows, , if it's 0 , it'll open window controller , on pressing shortcut? i'm using swift programming language. you have static variable incremented on successful initialization of view , decrements on deinit of view. can check value in guard statement before initialization or set menu availability based on variable. class windowcontroller: nswindowcontroller { static var count = 0 override func windowdidload() { windowcontroller.count += 1 } deinit { windowcontroller.count -= 1 } } func createwindow() { guard windowcontroller.count = 0 else { return } // create window here }

access a third-party Android app's data using Dropbox HTTP API -

i'm user of android app storing data in personal dropbox account, presumably using dropbox api. how can use dropbox api on http read data that's associated account? if app storing files, can browse them on computer running dropbox desktop app, or can browse them on dropbox.com. can use the api . if using deprecated datastore api, can find "download datastores" link next app on account security page . unfortunately, because api deprecated last year , turned off, there's no longer api access datastores.

objective c - Populate UITableView from JSON data -

i have json data [{"id": 1,"name": "nodia","company": "www","position": "hr","email": "sss@www.com","number": "33","photo": "image1.png"}, {"id": 2,"name": "nona ","company": "sss","position": "head of department","email": "aaaa@samsda.ge","number": "5496","photo": "image2.png"}, {"id": 3,"name": "david","company": "ddd","position": "director","email": "test@sasd.e","number": "574","photo": "image3.png"},....]| i create table view value name. tableviewcontroller.h : @interface citiesviewcontroller () @property(nonatomic,strong)nsmutablearray *jsonarray @property(nonatomic,...

python - Convert pandas df multi index to columns -

first post here, assistance appreciated. after reading csv file response api request using python urllib2, left multi index df. contains 19 index' 2 'columns'. how convert these 19 index' additional columns please? i tried resting index, no luck. from urllib2 import request, urlopen, urlerror import pandas pd url = 'url string here' response = urlopen(request) df = pd.read_csv(response) df.reset_index().head() to clear, example if index 1 contains letters a,b,c,d, change index column tittled 'letter' every row containing 1 of these letters. when reset_index, indeed populate every row letter, however, column still index.. edit.. .added more code first part gets df. from urllib2 import request, urlopen, urlerror import pandas pd host = 'testapi.bmreports.com' port = '443' rep_name = 'detsysprices' version = 'v1' key = 'ldytgh1ylq0k92c' sd = '2016-05-26' sp = 20 criteria = (host,port,rep_...

how do I write Pronto code into .wave file in android(Java) -

i working make remote functionality in android example have pronto hex code and want convert above wave file , after converting want play wave file medial player for example above on device , in activity have button , when click button audio playing, , have device generates signal when connect android phone on 3.5mm jack here python code: http://rtfms.com/wp-content/rtfms-com/pronto_code_to_wav.py if mean converting infrared burst rate in form {12,51,45,78,45,14} convert hex code decimal example : 0000 0002 010d should int[] burst ={0,2,543}//the numbers not correct example , dont forget frequency.

javascript - Data Structure for storing partial urls where search speed is the priority -

Image
we have large database of partial urls (strings) such as: "example1.com" "example2.com/test.js" "/foo.js" our software listens http requests , tries find 1 of our database's partial urls in http request's full url. so getting full urls (i.e.: http://www.example.com/blah.js?foo=bar ") , trying match 1 of our database's partial patterns on it. which best data structure store our partial urls database on if care search speed ? right now, do: iterating through entire database of partial urls (strings) , using indexof (in javascript) see if full url contains each partial string. update: this software extension firefox written in javascript on firefox's addon sdk . assuming partial strings domain names and/or page names try generate possible combinations url starting end: http://www.example.com/blah.js?foo=bar blaj.js example.com/blah.js www.example.com/blah.js then hash combinations, store them ...

assembly - Macro in loop works once, then doesn't -

procedure readval should loop , ask user input 10 integers (as strings), storing each in array. readval uses macro getstring , works first time through. other 9 times, prints "please enter unsigned integer:" not stop allow user enter value. so, it's calling macro, why not stop , wait input next 9 times. include irvine32.inc len = 10 ; number of elements in array. getstring macro buffer, size push eax push ecx push edx mov edx, offset usermsg_2 call writestring mov edx, buffer ; buffer passed reference, no offset req'd. mov eax, size mov ecx, [eax] ; dereference sizeelem ecx counter. call readstring pop edx pop ecx pop eax endm .data usermsg_2 byte "please enter unsigned number: ",0 array dword len dup(?) arlength dword len sizeelem byte 11 ; number of digits allowed in. reading ints strings. holder dword ? ; temp mem...

java - Custom AlertDialog disappears on back button press -

hi guys have custom alert dialog created. in builder set cancelable false yet still disappears when press button, ideas? this code dialog: public final class hemispheredialogfragment extends dialogfragment { @override public dialog oncreatedialog(bundle savedinstancestate) { // use builder class convenient dialog construction alertdialog.builder builder = new alertdialog.builder(getactivity()); layoutinflater inflater = getactivity().getlayoutinflater(); view customtitle = inflater.inflate(r.layout.hemisphere_dialog_custom_title, null); builder.setcustomtitle(customtitle); string[] entries = new string[2]; entries[0] = getresources().getstring(r.string.northern_hemisphere); entries[1] = getresources().getstring(r.string.southern_hemisphere); builder.setitems(entries, new dialoginterface.onclicklistener() { //the 'which' argument contains index position of selected item public void onclick(dialoginterface dialog, int wh...

java - WARN Exception in thread "Craft Scheduler Thread - 4" -

i'm trying use galistener every time /fakevote error: code (text): 28.05 21:15:17 [server] warn exception in thread "craft scheduler thread - 4" 28.05 21:15:17 [server] warn org.apache.commons.lang.unhandledexception: plugin galistener v1.3.2 generated exception while executing task 3856 28.05 21:15:17 [server] info @ org.bukkit.craftbukkit.v1_8_r3.scheduler.craftasynctask.run(craftasynctask.java:56) 28.05 21:15:17 [server] info @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) 28.05 21:15:17 [server] info @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) 28.05 21:15:17 [server] info @ java.lang.thread.run(thread.java:745) 28.05 21:15:17 [server] info caused by: java.lang.nosuchmethoderror: org.bukkit.server._invalid_getonlineplayers()[lorg/bukkit/entity/player; 28.05 21:15:17 [server] info @ com.swifteh.gal.rewardtask.run(rewardtask.java:37) 28.05 21:15:17 [server] info @ org.bukkit.craftbukkit.v1_8_...