Posts

Showing posts from June, 2012

trim - Delete spaces php -

i need delete tags string , make without spaces. i have string "<span class="left_corner"> </span><span class="text">adv</span><span class="right_corner"> </span>" after using strip_tags string " adv " using trim function can`t delete spaces. json string looks "\u00a0...\u00a0". help me please delete spaces. solution of problem $str = trim($str, chr(0xc2).chr(0xa0))

How to fix the issue with Applet dropdown choice boxes not working in Java 1.7? -

i searched issue , didn't find related questions or answers. have applet data entry application developed more 15 years ago using powerj tool in java 1.2. applet contains awt dropdown choice boxes user selects value , gets processed , saved database. working fine including in java 1.6 until installed java 1.7 update 25 on machine. spontaneously values not being recognized , leads kinds of incorrect behavior. thing see java console in terms of errors is: missing permissions manifest attribute missing codebase manifest attribute i put printout statements in code 1 of choice boxes debugging follows: _loc_nepa = choice_loc_nepa.getselecteditem().trim(); system.out.println("choice_loc_nepa.getselectedindex() = " + choice_loc_nepa.getselectedindex()); system.out.println("_loc_nepa = " + _loc_nepa ); the current value 'n'. value captured in java console follows: choice_loc_nepa.getselectedindex() = 0 _loc_nepa = does have solution? thank in adva

c# - Linq Count Unique Values in List -

i need count of unique items in list of orders. i have list of orders, , each order has list of items. public class order { public int orderid; public list<items> itemlist; } public class item { public int itemid; public int itemquantity; public string itemdescription; } my end goal list of unique items (based on itemid or itemdescription) total count of each unique item. i have following far, unsure next: var x = order in orders items in order.orderitems group // know need group them here select new { // have count in here }; i need outcome this: id: item_01, count: 15 id: item_02, count: 3 id: item_03, count: 6 any or direction on great. thanks. this sum using both itemid , itemdescription values: var x = order in orders item in order.orderitems group item new { itemid = item.itemid, itemdescription = item.itemdescription } g select new { itemid = g.key.itemid, itemdescription = g.key.itemdes

c++ - How to analyze program running time -

i trying optimize c++ program's performance , reduce run time. however, having trouble figuring out bottleneck. time command shows program takes 5 minutes run, , 5 minutes, user cpu time takes 4.5 minutes. cpu profiler (both gcc profiler , google perftool) shows function calls take 60 seconds in total in cpu time. tried use profiler sample real time instead of cpu time, , gives me similar results. i/o profiler (i used ioapps) shows i/o takes 30 seconds of program running time. so have 3.5 minutes (the largest bulk of program running time) unaccounted for, , believe bottleneck is. what did miss , how know time goes? as Öö tiib suggested, break program in debugger. way program running, switch output window, type ctrl-c interrupt program, switch gdb window, type "thread 1" in context of main program, , type "bt" see stack trace. now, @ stack trace , understand it, because while instruction @ program counter responsible particular cycle bein

Copying files and renaming files into the original folder using Powershell -

i new scripting process. i've been googling problem on week, , have found snippets of pieces of need, can't figure out how put together. i need following: folder1/main.txt folder1/subfolder/main.txt folder2/main.txt folder3/main.txt i need make copy of main.txt , rename temp.txt same folder... (except, have thousand of these files do!) so have this: folder1 > main.txt > temp.txt folder1/subfolder > main.txt > temp.txt folder2 > main.txt > temp.txt folder3 > main.txt > temp.txt any appreciated. thank you! in powershell: get-childitem 'c:\some\folder' -filter 'main.txt' -recurse | % { copy-item $_.fullname (join-path $_.directory 'temp.txt') } in batch: @echo off /r "c:\some\folder" %%f in (main.txt) ( copy "%%~ff" "%%~dpftemp.txt" )

vba - Will SaveSetting always work regardless of security restrictions? -

i developing vba application, , save information data file last imported application. assuming registry place store this, i'm concerned deploying solution, whether or not policy ever prevent vba's savesetting function working. so question is, savesetting/getsetting work in vba, or there way user's it/security policy restrict functions working?

php - get the title of a page -

i getting title of page using following $urlcontents = file_get_contents("$url"); preg_match("/<title>(.*)<\/title>/i", $urlcontents, $matches); the problem having 1 of sites title on 3 lines <head id="head"><title> title goes here </title><meta name="description" content="meta description" /> this basic onpage seo tool writing, there better way can title of page? thank you i found answer here get title of website via link $urlcontents = file_get_contents("http://example.com/"); $dom = new domdocument(); @$dom->loadhtml($urlcontents); $title = $dom->getelementsbytagname('title'); print($title->item(0)->nodevalue . "\n"); // "example web page" thank you

grails - Unable to save a domain class instance from Groovy Console in GGTS -

i creating grails project using groovy/grails tool suite. if choose run >> groovy console , can create sample objects domain classes cannot save them. so, new things.thing(height: 20, length: 30) creates new thing, but new things.thing(height: 20, length: 30).save() throws exception no signature of method: thing.thing.save() applicable argument types: () values: [] even though respondsto states things respond save(). does know why happening? that's groovy console, not grails console. use same code , same, grails version hooks application, whereas groovy console has access code. run console, go grails tools | open grails command prompt , enter console in text field. this gui wrapper running grails console commandline.

pipe - How to grep copied content -

i have content (say paragraph or hundred odd lines book - have newlines) have copied. how grep them? mean there utility can echo content output can fed grep command through pipe ? thanks. where content? if in file 'foo' try grep -e whateveryouarelookingfor foo if in bash variable 'bar' try echo "${bar}" | grep -e whateveryouarelookingfor

html - Accessing nested objects in javascript -

i trying run javascript, not working. i have object 2 properties objects. var people = { me: { name: "hello" }, molly: { name: "molly" } }; and trying make function uses for/in statement , if statement list properties of people. var search = function (x) { (var in people) { if (people.a.name === x) { return people.a; } } }; so function loops through properties of people , assigns them variable a. therefore people.a equal property of people. function returns property (people.a). so if type in me parameter x, function should return properties me object? put code in jslint , jshint , passed, decided remove corrections because useless. i want print object properties in browser: var print = search("me"); document.getelementbyid("p").innerhtml(print); i have linked html document, tag id "p". ha

python - Have bash script execute multiple programs as separate processes -

as title suggests how write bash script execute example 3 different python programs separate processes? , able gain access each of these processes see being logged onto terminal? edit: again. forgot mention i'm aware of appending & i'm not sure how access being outputted terminal each process. example run 3 of these programs separately on different tabs , able see being outputted. you can run job in background this: command & this allows start multiple jobs in row without having wait previous 1 finish. if start multiple background jobs this, share same stdout (and stderr ), means output interleaved. example, take following script: #!/bin/bash # countup.sh in `seq 3`; echo $i sleep 1 done start twice in background: ./countup.sh & ./countup.sh & and see in terminal this: 1 1 2 2 3 3 but this: 1 2 1 3 2 3 you don't want this, because hard figure out output belonged job. solution? redirect stdout (and optionally s

What is the memory visibility of variables accessed in static singletons in Java? -

i've seen type of code lot in projects, application wants global data holder, use static singleton thread can access. public class globaldata { // data-related code. anything; i've used simple string. // private string somedata; public string getdata() { return somedata; } public void setdata(string data) { somedata = data; } // singleton code // private static globaldata instance; private globaldata() {} public synchronized globaldata getinstance() { if (instance == null) instance = new globaldata(); return instance; } } i hope it's easy see what's going on. 1 can call globaldata.getinstance().getdata() @ time on thread. if 2 threads call setdata() different values, if can't guarantee 1 "wins", i'm not worried that. but thread-safety isn't concern here. i'm worried memory visibility. whenever there's memory barrier in java, cached memory synched between corresponding

java - Set the button "background" of a Nimbus button -

Image
i'm working on app using nimbus , feel. there's table , 1 column contains buttons (using table button column rob camick ). work, result isn't had expected. have tried fix look, no avail. so question is: how change "background" (the area outside rounded rectangle) of nimbus button? preferably in non-hacky way :-) using default table column button, result looks this: as can see, background (and mean area outside button's rounded rectangle) wrong odd (white) rows. code produces output is: public component gettablecellrenderercomponent( jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { if (isselected) { renderbutton.setforeground(table.getselectionforeground()); renderbutton.setbackground(table.getselectionbackground()); } else { renderbutton.setforeground(table.getforeground()); renderbutton.setbackground(table.getbackground()); } if (hasfocus) {

java - shiro + ehcache + replication: login and logout not being replicated -

our web application using shiro authentication. we're storing sessions in ehcache, backed filestore, , using replication ensure web servers have of sessions. using peer peer replication, not multicast configuration. things seem work of time. however, time time, logins or logouts not replicated. we see stacktraces following exception: org.apache.shiro.session.unknownsessionexception: there no session id [dc996ea4-daff-431f-946b-6a5a214f9477] if file goes out of sync, stays out of sync. does have suggestion why might see behavior? frankly, i'd try away peer-to-peer replication altogether...as has potential race conditions , concurrent exceptions, explain missing entries @ random. i'd move towards more robust distributed caching solution using bigmemory max free 4 clients + 4gb of memory storage ( http://terracotta.org/products/bigmemorymax ) edit - fyi, bigmemory max still ehcache...it's "distributed ehcache" "off-heap" memory cap

asp.net - How to prevent IEDriverServer.exe process to launch multiple times? -

i'm using selenium , ie web driver. whenever test starts, ie driver server starts too, doesn't close/exit after test finishes. next test run, end multiple instances of iedriverserver.exe processes sitting around. how close after test run? below sample code use: [testclass] public class unittest1 { [testmethod] public void testmethod1() { var ie = new openqa.selenium.ie.internetexplorerdriver(new openqa.selenium.ie.internetexploreroptions() { introduceinstabilitybyignoringprotectedmodesettings = true }); ie.navigate().gotourl("http://localhost:50640/"); ie.close(); ie.close( assert.istrue(true); } } i know can use processinfo kill it, it'll nice have selenium solution. have tried using ie.quit(); ? please refer documentation , source code . quit() 1 quit (the browser , driver). close() closing browser window. why here in case, iedriverserver.exe left open.

Centering CSS menu -

i have found css menu wanted implement webpage. menu can seen here: http://apycom.com/menus/4-red.html the problem is, not expert on css, changes, unfortunately no matter tried didnt needed. so basically, css here: http://apycom.com/ssc-data/themes/default/styles/menu.css now have exact same menu, have centered on page. tried various things, never worked. , also, if possible have stretched 100% of screen. tried unsuccesfully. look man see this: http://cdpn.io/jbhkd . thing you've first specify width menu i've used in example : width : 500px; , set margin i've put in there margin : 0 auto; make menu in center of page. the menu don't have easing effect because you've buy full version of menu, or link of apycom website appear on menu. i've focused on centering of menu. hope i've helped ^_^

java - Cleaning up code but not working -

i'm trying clean code little. here have far: next class updated*** } } **errors below:** ----jgrasp exec: javac -g gradesorter.java gradesorter.java:18: error: cannot find symbol intnode = new intnode(); ^ symbol: class intnode location: class gradesorter gradesorter.java:18: error: cannot find symbol intnode = new intnode(); ^ symbol: class intnode location: class gradesorter 2 errors ----jgrasp wedge2: exit code process 1. ----jgrasp: operation complete. the code not formatted before , single file no methods or classes. i'm trying transfer over. program working before. don't know how call variable in main class on subclass. first off standard java style class names capatilizaed unlike method names. i.e public class gradesorter; i don't know if you're using try catch how want use it. right when try find file "grades.dat", if generates exception them creates , intnode objec

ios - Compressing UIImage as Far as Possible? -

Image
i trying compress down selected uiimage far reasonably possible. compressing so: uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage]; nsdata *imagedata = [[nsdata alloc] initwithdata:uiimagejpegrepresentation((image), 0.1)]; according length of data, come in anywhere between 250kb , 600kb depending on photo selected. maximising on storage essential me. how suggest might compress photos down little further? method know of. thanks. there web page nice chart regarding quality , file size. jpeg compression data loosing algorythm. if doesn't matter quality change color palette 256 or 8 color ( grayscale) , after use maxed compression.

sql server - Database Schema guidance for an app store -

i creating sample project , want demonstrate small app store functionality. need basic database schema start. database schema (er diagrams) available of stores (apple app store or google play)? i looking schema examples can refer to. apple , google not releasing public documentation of backend architecture respective app stores . although there few examples of actual data model scenario found using google, instance barry williams produced this small sample of mobile app store's data model. this answer question example of schema app store . i'm pretty sure such task more efficiently achieved starting scratch adapting existing model. recommend have @ basic modeling strategies , further skills in data modeling, find pretty easy do. good luck sample project , don't hesitate comment if have further questions!

Reading password from Console in java -

i want read password console in 1 java program. used console newconsole = system.console(); but able declare , initialize console object in class. getting error message " method console() undefined type system" , " console cannot resolved or not type" hence thought don't have latest java version , checked java version using c:\>java -version java version "1.7.0_21" i came know have java 1.7.0_21 latest version still getting error. please me regarding this. if can't use system.console there other method can use read password hidden character console. the complete code : import java.io.console; public class test { public static void main(string[] args) { console newconsole = system.console(); } } i getting compiler error in import java.io.console (java.io.console cannot resolved) , console newconsole = system.console(); (the method console() undefined type system , console cannot resol

installation - error: could not create '/Library/Python/2.7/site-packages/xlrd': Permission denied -

i'm trying install xlrd on mac 10.8.4 able read excel files through python. i have followed instructions on http://www.simplistix.co.uk/presentations/python-excel.pdf i did this: unzipped folder desktop in terminal, cd unzipped folder $ python setup.py install this get: running install running build running build_py creating build creating build/lib creating build/lib/xlrd copying xlrd/__init__.py -> build/lib/xlrd copying xlrd/biffh.py -> build/lib/xlrd copying xlrd/book.py -> build/lib/xlrd copying xlrd/compdoc.py -> build/lib/xlrd copying xlrd/formatting.py -> build/lib/xlrd copying xlrd/formula.py -> build/lib/xlrd copying xlrd/info.py -> build/lib/xlrd copying xlrd/licences.py -> build/lib/xlrd copying xlrd/sheet.py -> build/lib/xlrd copying xlrd/timemachine.py -> build/lib/xlrd copying xlrd/xldate.py -> build/lib/xlrd copying xlrd/xlsx.py -> build/lib/xlrd creating build/lib/xlrd/doc copying xlrd/doc/compdoc.html -> bui

regex - Mod Rewrite php htacess -

i'm trying use clean urls on website better seo. i'm doing doing using mod rewrite htaccess. url follows http://mywebsite.com/s.php?share=100 , accept urls http://mywebsite.com/s/100 or whatever number user chooses. i'm using rewrite regex expression not working expected rewriteengine on rewritecond %{request_filename}!-f rewritecond %{request_filename}!-d rewriterule ^([a-z]+)/([a-z\-]+)$ /$1/$2.php rewriterule ^share/([^/]*)$ /s.php?share=$1 [l] can point me i'm doing wrong? you want url http://mywebsite.com/s/100 , meaning uri /s/100 , pattern looks ^share/([^/]*)$ . since uri doesn't begin " share ", pattern never match uri want. try: rewriterule ^s/([^/]*)$ /s.php?share=$1 [l] also, since requesting /s/ , have file called /s.php , need make sure multiviews turned off: options -multiviews so altogether, like: options -multiviews rewriteengine on rewritecond %{request_filename}!-f rewritecond %{request_fi

c++ - Why am i getting this compile error when i try to compile? -

i some-what new programming in c++ assigned exercise i'm getting compile error i hoping can either me resolve error or give me insight why happening code below /* exercise 21 intermediate: declare seven-row, two- column int array named temperatures. program should prompt user enter highest , lowest temperatures 7 days. store highest temperatures in first column in array. store lowest temperatures in second column. program should display average high temperature , average low temperature. display average temperatures 1 decimal place. */ #include <iostream> #include <iomanip> using namespace std; //function prototype void calcaverage(double temperatures[7][2]); main() { double temperatures[7][2] = {0}; float high = 0.0; float low = 0.0; double high_average = 0.0; double low_average = 0.0; cout << "please enter high low last 7 days " <<endl; for(int x = 0; x < 6; x += 1) { cout << "please enter high day: "<

php - Selecting a collection with a dot in its name -

i select collection using following method... assuming collection name "fantastic" in database called "somedb" $conn = new mongo(); $fantastic_coll = $conn->somedb->fantastic; this has worked famously me long time. number of collections using has grown lot , i'm trying use dots in collection names organise them little more logically. eg. store.items store.categories store.coupons events events.categories this seems work fine in mongodb shell, not in php? if try.... $conn = new mongo(); $store_coupons_coll = $conn->somedb->store.coupons; and try save documents collection doesn't me. if instead use... $conn = new mongo(); $store_coupons_coll = $conn->somedb->selectcollection('store.coupons'); everything works expected. right way it? if hope helps having same trouble. if not there short way write collection name? is using dots in collection name organisation wrong begin with? the preferred

algorithm - Find positive integer that can't be expressed by [x/2] y x*y? -

there expression: [x/2] + y + x * y, x , y positive integers, [x/2] mean rounding down integer, example, [3/2] = 1. positive integers can't expressed expression, example, 1, 3. now, question how find out first 40 numbers? when x = 1, expression 2*y, number must not number. when y = 1, expression [x/2] + x + 1, not include 3*n. tried follow: int64_t givean( int n ) { if( n == 1 ) return 1; if( n == 2 ) return 3; int = 3; int count = 2; while( true ){ int64_t m = * 3; bool ok = true; for( int x = 3; x <= ( 2*m - 2 ) / 3; x++ ){ if( ( x / 2 + x + 1 ) >= m ){ ok = false; } if( !( ( m - x/2 ) % ( x + 1 ) ) ){ ok = false; break; } } if( ok && ++count == n ){ return m; } += 2; } } the first 7 numbers can found, find eighth number cost 2 minutes... first 8 numbers are: 1 3 15 63 4095 65

Android menu item list navigation -

i need please me switch , case... i have 3 item in action bar item1, item2, item3 , have 3 activity item1activity.java, item2activity, item2activity.. want call activity menu when item selected.. public class mainactivity extends activity { /** array of strings populate dropdown list */ string[] actions = new string[] { "item1", "item2", "item3" }; protected int position; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); /** create array adapter populate dropdownlist */ arrayadapter<string> adapter = new arrayadapter<string>(getbasecontext(), android.r.layout.simple_spinner_dropdown_item, actions); /** enabling dropdown list navigation action bar */ getactionbar().setnavigationmode(actionbar.navigation_mode_list); /** defining navigation listener */ actionbar.onnaviga

c# - Can I retrieve the interface type within an interface method? -

how can determine underlying interface method dosomething() called? additional question: can determine underlying interface in myclass constructor? assume not not known @ instantiation time, correct? edit: not looking explicit interface implementations different way determine underlying interface. public interface itest { void dosomething(); //....more methods } public interface idecoy { void dosomething(); //...more methods } public class myclass : itest, idecoy { public void dosomething() { //question: how can determine underlying interface called method? //at 1 time itest, @ idecoy. how can figure out 1 @ each time? } } public class test { public test() { itest myclassinstance1 = new myclass(); idecoy myclassinstance2 = new myclass(); myclassinstance1.dosomething(); myclassinstance2.dosomething(); } } public class myclass : itest, idecoy { void itest.dosomething() {

r - RODBC sqlSave(..., fast = FALSE) - "RODBCTypeInfo" not available for .Call() for package "RODBC" -

my sqlsave query works perfectly fast = true fails following error fast = false (connecting ms .accdb ): > db <- odbcconnectaccess2007(path_out) > sqlsave(db, df, "tbltest", rownames = f, append = t, fast = f) error in .call("rodbctypeinfo", attr(channel, "handle_ptr"), as.integer(type), : "rodbctypeinfo" not available .call() package "rodbc" > traceback() 4: .call("rodbctypeinfo", attr(channel, "handle_ptr"), as.integer(type), package = "rodbc") 3: sqltypeinfo(channel) 2: sqlwrite(channel, tablename, dat, verbose = verbose, fast = fast, test = test, nastring = nastring) 1: sqlsave(db, df, "tbltest", rownames = f, append = t, fast = f) i don't understand error message myself, ideas why? (i trying test how slower fast = false be)

asp.net - Start an Instance of Autodesk Inventor -

am using inventor api customizing inventor documents.here use vb.net code start instance of inventor .my code inventorapp = createobject("inventor.application", "") inventorapp.visible = true it ok , working fine .but when open visual studio run administrator createobject having error.any 1 know other way start instance of inventor? try using marshal method instead. dim m_inventorapp inventor.application try ' try use active inventor instance try m_inventorapp = system.runtime.interopservices.marshal.getactiveobject("inventor.application") m_inventorapp.silentoperation = true catch ' if not active, create new instance of inventor dim inventorapptype type = system.type.gettypefromprogid("inventor.application") m_inventorapp = system.activator.createinstance(inventorapptype) ' must set visible explicitly m_inventorapp.vi

php - Does request_terminate_timeout overwrite max_execution_time? -

does request_terminate_timeout in php-fpm pool definitions overwrite max_execution_time in php.ini file? apparently the're both doing same thing @ different levels. max_execution_time honored php , request_terminate_timeout handled fpm process control mechanism. whichever set lowest value kick in first. apache has idle-timeout parameter observes , give on php process after time. also maximum execution time not affected system calls, stream operations etc. so need take account well.

java - scala - bash: hw.scala: Permission denied -

i installed scala sbt according post getting started . but when created easy start project hello world met weird output: nazar_art@nazar-desctop:~$ find .sbt .sbt .sbt/.lib .sbt/.lib/0.12.1 .sbt/.lib/0.12.1/sbt-launch.jar .sbt/boot .sbt/boot/update.log nazar_art@nazar-desctop:~$ cd hello nazar_art@nazar-desctop:~/hello$ echo 'object hi { def main(args: array[string]) = println("hi!") }' > hw.scala bash: hw.scala: permission denied nazar_art@nazar-desctop:~/hello$ sbt java.io.filenotfoundexception: /home/nazar_art/.sbt/boot/update.log (permission denied) @ java.io.fileoutputstream.open(native method) @ java.io.fileoutputstream.<init>(fileoutputstream.java:212) @ java.io.fileoutputstream.<init>(fileoutputstream.java:165) @ java.io.filewriter.<init>(filewriter.java:90) @ xsbt.boot.update.<init>(checks.java:51) @ xsbt.boot.launch.update(launch.scala:266) @ xsbt.boot.launch$$anonfun$jnaloader$1.apply(launch.

location - Android google maps - make polyline more straighter /smoother -

i creating app draw walking path gps. okay, path drawing when walk, have 1 question - possible somehow make path line straighter programmatically? for example. first, after walking see path this(it not polyline, polygon in example, think idea): https://www.dropbox.com/s/763mq0wja6x7lpy/11.png but after saving, app made path more straighter/smoother: https://www.dropbox.com/s/npwkz9coqve7m4g/22.png how this? because don't have idea. i drawing path locationlistener : locationmanager locationmanager = (locationmanager)this.getsystemservice(context.location_service); criteria criteria = new criteria(); //criteria.setpowerrequirement(criteria.power_low); criteria.setaccuracy(criteria.accuracy_fine); criteria.setaltituderequired(false); criteria.setbearingrequired(false); criteria.setcostallowed(true); criteria.setspeedrequired(false); string bestprovider = locationmanager.getbestprovider(criteria, true); locationmanager.requ

How to obtain multiple lines from a input file when the file sometimes contains random empty lines in python -

there lot of questions reading input files out there, none of once i've seen have helped me. it's easier understand if show part of input file first. input file created program, there nothing can there. seclfxx 150.00 0.000 35.000 3.213e+03 -7.624e+03 8.274e+03 -67.151 17.000 -3.549e+04 1.012e+04 3.690e+04 164.084 16.000 -4.755e+04 -5.719e+03 4.789e+04 -173.141 15.500 -4.591e+04 -2.862e+04 5.410e+04 -148.062 15.000 -2.781e+04 -7.743e+04 8.227e+04 -109.756 14.500 2.492e+04 -1.973e+05 1.988e+05 -82.799 seclfxy 150.00 0.000 35.000 3.213e+03 -7.624e+03 8.274e+03 -67.151 17.000 -3.549e+04 1.012e+04 3.690e+04 164.084 16.000 -4.755e+04 -5.719e+03 4.789e+04 -173.141 15.500 -4.591e+04 -2.862e+04 5.410e+04 -148.062 <square box>

android - Empty ListView when EditText is empty -

i have code takes data sqlite cursor , puts listview. private void displaylistview() { cursor = mydatabase.getjoinedinfo(etsearch.gettext().tostring().trim()); string[] columns = new string[] { "re_value", "g_value", "ke_value" }; int[] = new int[] { r.id.tvhiragana, r.id.tvmeaning, r.id.tvkanji }; dataadapter = new simplecursoradapter(this, r.layout.wordonlist, cursor, columns, to, 0); listview listview = (listview) findviewbyid(r.id.lvwordlist); // assign adapter listview listview.setadapter(dataadapter); } when edittext empty, taking first 10 lines. how show empty listview when edittext empty? do : if(youredittext.length() == 0) yourlistview.setadapter(null); or can use : if(youredittext.length() == 0) youradapter.clear();

css - Gradient ends are blurry when using pixel measurements -

i'm using background-image: linear-gradient css property create multiple color strips site background. gradient stops defined percentage, needed pixels in site, managed change pixels using method lea verou used in patterns problem end of each color bit blurry. in firefox it's less noticeable, in chrome it's noticeable. there way handle it? noticed when change 'deg' 180 45 ends great. unfortunately need stripes horizontal :) my code: http://cssdesk.com/c6mgm almost year later , run same bug in chrome v36. produced work around here: http://codepen.io/davidgailey/pen/ncrkb or here if prefer: https://gist.github.com/davidgailey/8fc1bd1a09747429a3ad the work around uses background-size, background-position, , linear gradients. background-size: 100% 150px, 100% 150px; background-position: 0 0, 0 bottom; background-image: linear-gradient(#000,#000), linear-gradient(green, green); viola! nice crisp horizontal stripes. use work more future-fri

ios - Font issue with Apportable -

looks there issue fonts support when porting cocos2d ios project using apportable. if font extensions written capital letters "cartoon.ttf" , labels initialized "cartoon.ttf" text not visible or used standard font instead of defined. would nice have font support no meter of letters case in apportable to fix should rename font extension lower case letters "cartoon.ttf" , change labels property "cartoon.ttf".

c++ - FFmpeg: HLS options cannot be set/get/find -

we using ffmpeg libraries git-ee94362 libavformat v55.2.100 . trying write simple hls code example based on muxing.c standard one. let 2 input streams, video , audio (they can synthetic, doesn't matter). our purpose mux them m3u8 playlist using hls . suppose, duration of every ts segment file 3 sec, , desirable maximum number of entries in m3u8 output file 100. from ffmpeg application sources, 1 can see apple http live streaming segmenter implemented in hlsenc.c file. , relevant options there are, well: "hls_list_size" , "hls_time" , etc. problem have not succeeded set/get/find these options in conventional way, shown in following code: // here part of main() program int64_t i1 = 0; void *target_obj; avformatcontext *ofmt_ctx = null; avoutputformat *ofmt = null; avformat_alloc_output_context2(&ofmt_ctx, null, null, "example_out.m3u8"); ofmt = ofmt_ctx->oformat; // relevant options ("hls_list_size", "hls_

maps - Travelling Salesman with latitude/longitude coordinates? -

travelling salesman latitude/longitude coordinates? i reading many heuristics tsp , many use euclidian x/y coordinates. have data latitude , longitude, how use heuristics? is, there meaningful way go latitude/longitude x/y coordinates? thanks for score function, can use pythagoras directly on latitude , longitude calculate distance between 2 points. to visualize in panel specific width , height, take @ latitudelongitudetranslator (java, open source, asl 2.0) used in tsp gui .

flash - Converting GIF to SWF in Flex -

so wanted convert gif file swf format, without using exe file (there's bunch available free downloads). make in php/flex if possible. know php can execute linux commands, way go (there tools linux), wondering if there library flex can - let else's computer on client side :) anyone got experience this? thx the as3gif library allows display gif images in flash applications. an approach export resulting displayobject bytearray. var data:bytearray = new bytearray(); data.writeobject(gif); you can send raw data server or let user save file (at least air).

c# - Whether Windows 8.1 apps will work in Windows 8 PC? -

i developing application in windows 8.1 preview release using vs 2013. when deploy app package in windows 8 pc, did not run. have small question whether windows 8.1 developed apps run in windows 8 pc. if needs run, other specification suppose provided apps or pc ? if target 8.1 app not run in windows 8. because api of 8.1 extended , new features not exist in windows 8. if develop in windows 8.1 , target windows 8. apps work out of box. for example, windows 8.1 supports new controls. if target 8.1 can use controls, when use windows 8, controls not exist , application cant run.

c# - Select SUM if NULL - UPDATE "0" -

i have got code selects sum , update result somewhere. issue when there no results found select sum(castka) conditions. i'm wondering how make exception dbnull if there wasn't found result , update "0" instead. i'm not long programming please me solve out? thank time. private void btn_zavri_click(object sender, eventargs e) { try { spojeni.close(); sqlcommand sc2 = new sqlcommand("select sum(castka) sumcastka kliplat akce='" + zakce.text + "' , rocnik='" + rocnik + "'", spojeni); spojeni.open(); int vysledek2 = convert.toint32(sc2.executescalar()); sqlcommand sc3 = new sqlcommand("update zajezd set s_prijmy=@s_prijmy akce='" + zakce.text + "' , rocnik='" + rocnik + "'", spojeni); spojeni.close(); sc3.parameters.addwithvalue("@s_prijmy", vysledek

Can I learn working with DAO in Spring without knowing Spring AOP? -

i learning spring , new it, want skip learning aop , continue learning how work dao .can have understanding of dao without knowing aop? yes, can. spring aop not required learning dao . aop different concept. according requirements, can integrate both of them.

c# - Complex type mapping via linq to xml -

i have list of contacts in xml file. each contact have few properties , mdpr:connection in it. connection separate object. read list , contacts list standard proeprties how map connection object. <?xml version="1.0" encoding="utf-8"?> <mdpr:data xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mdpr="http://..."> <mdpr:contactlist> <mdpr:contact id="{123456}" classid="customer"> <mdpr:name>data1</mdpr:name> <mdpr:transportcode>data2</mdpr:transportcode> <mdpr:connection connectionindex="0" fromid="{12345}" toid="{123456}"> <mdpr:status>1-5</mdpr:status> <mdpr:startdate>2012-03-13t10:23:00z</mdpr:startdate> <mdpr:enddate>2013-03-13t13:44:00z</mdpr:enddate> </mdpr:connection> </mdpr:contact> </mdpr:contactlist>

c# - Generating a .txt File From a DataTable -

i creating text file on fly based on data gathered in datatable . my current (test) dataset has 773 rows, want split comma (,) each column , break each row on separate line. here's attempt; string filename = "test_" + system.datetime.now.tostring("ddmmyyhhmm") + ".txt"; streamwriter sw = file.createtext(@"path...." + filename); foreach (datarow row in product.rows) { bool firstcol = true; foreach (datacolumn col in product.columns) { if (!firstcol) sw.write(","); sw.write(row[col].tostring()); firstcol = false; } sw.writeline(); } the output text file, expected. instantly, of data appears, text file never displays 773 rows. have tried several times, number of rows can vary 720 rows 750 row

C# Monotouch/Xamarin - iOS Bluetooth connection to multiple phones? -

does know if it's possible use bluetooth connect multiple phones using c# monotouch/xamarin ios? update i'd preferably connect multiple phones 1 main phone host, via bluetooth (1 host , 3 or 4 clients). i don't know great deal bluetooth , various profiles, i'd looking guidance on aspect also. yes, can. ios 7.0 introduced multipeer connectivity framework. can work both bluetooth and/or wifi (and can bridge between them, pretty neat). you can find sample code (e.g. chat , mixed ibeacons ) googling around multipeer connectivity , ios , monotouch .

oracle - error getting while inserting multiple rows in sql -

my table create table emp( emp_no number, emp_name varchar2(10 byte), address varchar2(15 byte), ph_no number(10,0), dpt_no number ) inserting query: insert emp ( emp_no, emp_name, address, ph_no, dpt_no) values (100,'mohan','hyd',7569936347,101), (101,'ram','ctr',9553438342,102); in manner write insert query multiple records inserting purpose...but i'm getting error "sql command not perperly ended.i don't know how rwsolve 1 one..any can me assuming using sql server prior 2008. cannot use syntax separate rows. write different insert commands or use select statement using union force them 1 insert command. edit: since using oracle see if this helpful.

Paypal IPN callback stopped working in sandbox environment -

i'm having problem paypal ipn callback. paypal's ipn callback stopped working, in sandbox environment. i've been testing client's website, past weeks, , has been working correctly - payment made, , callback ipn sent website, confirming payment, , updating website's database. i haven´t change in code, , stopped working. payment still made , saved in paypal account, ipn retrying... doesn't complete. here's code in use: <?php // step 1: read post data // reading posted data directly $_post causes serialization issues array data in post. // instead, read raw post data input stream. $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $mypost = array(); foreach ($raw_post_array $keyval) { $keyval = explode ('=', $keyval); if (count($keyval) == 2) $mypost[$keyval[0]] = urldecode($keyval[1]); } // read ipn message sent paypal , prepend 'cmd=_notify-validate' $req = &

php - show ebay feedback on my website -

well, have web host , code shows ebay feedback, need not code related website, mean want own code. found code can me still need help, here's code , works well: <link rel="stylesheet" type="text/css" href="http://gamila-secret.comyr.com/styles/feedback.css" /> <script type="text/javascript" src="http://www.pc-homecare.co.uk/ebay/feedback.php?id=[userid]&site=[siteid]&seller=[seller]"></script> as said need own code, did getting style file , rebuild it, still need javascript file, went page " http://www.pc-homecare.co.uk/ebay/feedback.php?id=[userid]&site=[siteid]&seller=[seller] " got code, , copied source(its codes), made new file in server code unfortunately did not worked. ideas how can functions codes work on own server? you can use get_file_contents in php contents of url (see php.net/manual/en/function.file-get-contents.php). <?php $page = file_get_contents(

c# - .Net correspondings of WinApi TabControl styles -

within each tab, control centers icon , label, placing icon left of label. in winapi can force icon left, leaving label centered, specifying tcs_forceiconleft style. can left-align both icon , label using tcs_forcelabelleft style. how can make same in c#? there similar question , solution not work me, despyte use edward's advice. in class derived tabcontrol (i need draggable tabs, while tab dragged alignment of label breaks since set sizemode fixed tabs same width , dragging): [dllimport("user32.dll", entrypoint = "setwindowlong", charset = charset.auto)] protected static extern bool setwindowlong32(intptr ptr, int index, int value); [dllimport("user32.dll", entrypoint = "setwindowlongptr", charset = charset.auto)] protected static extern bool setwindowlongptr64(intptr ptr, int index, int value); [dllimport("user32.dll", entrypoint = "setwindowpos")] protected static extern intptr setwindowpos(intptr hwnd, int hwnd

ruby - How does this custom route matcher in Sinatra example work? -

in sinatra readme , there section called custom route matchers following example: class allbutpattern match = struct.new(:captures) def initialize(except) @except = except @captures = match.new([]) end def match(str) @captures unless @except === str end end def all_but(pattern) allbutpattern.new(pattern) end all_but("/index") # ... end would helpful enough talk me through how works? bit i'm not sure why example has match struct , captures are. user can't set @captures instance variable, @except one; how captures used? when route processed, takes argument get (or post or whatever), , sends object's match method path argument . expects either nil mean didn't match, or array of captures. object string or regex , both have match method. sinatra calls on captures method of object when processing route . example uses struct easy way set , respond object respond captures , , puts in array, that's capt

php - filter array after merging keys of one array -

i trying create filtered array 3 using array 1 , array 2 . array 1 array ( [title] => value [title2] => value2 [title3] => value3 ) array 2 array ( [0] => array ( [id] => 20 [title2] => value2 [othercolumn1] => othervalue1) [1] => array ( [id] => 21 [title4] => value4 [othercolumn3] => othervalue3) ) desired result after applying intersection method: array 3 array ( [title2] => value2 ) so far unable achieve result because array 1 , 2 have non-matching structures. have tried different techniques unable compare them due structure differences. if (!empty($data1['array2'][0])) { foreach ($data1['array2'] $key) { // $filtered= array_intersect($array1,$key); // print_r($key); } // $filtered= array_intersect($array1,$data1['array2']);// if use $data1

c# - Ling-to-Sql issue when bind SQL to WP8 using WebService -

Image
i have tried create first wp8 application bind data sql database . followed this tutorial black page appears . as there no listbox in wp8 tools used longlistselector following: mainpage.xaml shell:systemtray.isvisible="true"> <phone:phoneapplicationpage.resources> <datatemplate x:key="toursdatatemplate"> <stackpanel orientation="horizontal"> <textblock margin="10" text="{binding name}"/> </stackpanel> </datatemplate> </phone:phoneapplicationpage.resources> <!--layoutroot root grid page content placed--> <grid x:name="layoutroot" background="transparent"> <grid.columndefinitions> <columndefinition width="9*"/> <columndefinition width="7*"/> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition height="auto&

c# - Implementing an interface with a Windows Form -

i'm new using interfaces have question pretty easy of you. i trying make interface windows form. looks like interface myinterface { //stuff stuff stuff } public partial class myclass : form, myinterface { //more stuff stuff stuff. form } the problem comes when try implement it. if implement with myinterface blah = new myclass(); blah.showdialog(); the showdialog() function available it. makes sense- myinterface interface, not form... i'm curious how should go implementing interface windows form, or if viable option @ all. does have suggestions how should go doing that? thanks! this appears question how correctly expose members of class. internal - access method/class restricted application public - access not restricted private - access restricted current class (methods) protected - access restricted current class , inherited classes an example use of interface share common method signatures between classes interface ianimal { int fe

C# api responce and request -

i have code try { string url = "http://myanimelist.net/api/animelist/update/" + "6.xml"; webrequest request = webrequest.create(url); request.contenttype = "xml/text"; request.method = "post"; request.credentials = new networkcredential("username", "password"); byte[] buffer = encoding.getencoding("utf-8").getbytes("<episode>4</episode>"); stream reqstr = request.getrequeststream(); reqstr.write(buffer, 0, buffer.length); reqstr.close(); messagebox.show("updated"); } catch (exception s) { messagebox.show(s.message); } i trying send data myanimelist.net code have written this url: http://myanimelist.net/api/animelist/update/id.xml formats: xml http method(s): post req