Posts

Showing posts from August, 2010

app store - Question about selling iphone app -

if have app on app store allowed sell on website ? you can create website it, can promote there, can put direct link appstore on page, etc. there's no other way how distribute - appstore. otherwise users no able install on phones.

Error while connecting to Oracle using JDBC -

i trying connect oracle db using jdbc. i have put ojdbc.jar in classpath. ora-01034: oracle not available ora-27101: shared memory realm not exist ibm aix risc system/6000 the database identified oracle_sid in database url not running. oracle_sid = case sensitive ..... i hope helps, ronald.

python - Why doesn't list have safe "get" method like dictionary? -

>>> d = {'a':'b'} >>> d['a'] 'b' >>> d['c'] keyerror: 'c' >>> d.get('c', 'fail') 'fail' >>> l = [1] >>> l[10] indexerror: list index out of range ultimately doesn't have safe .get method because dict associative collection (values associated names) inefficient check if key present (and return value) without throwing exception, while super trivial avoid exceptions accessing list elements (as len method fast). .get method allows query value associated name, not directly access 37th item in dictionary (which more you're asking of list). of course, can implement yourself: def safe_list_get (l, idx, default): try: return l[idx] except indexerror: return default you monkeypatch onto __builtins__.list constructor in __main__ , less pervasive change since code doesn't use it. if wanted use lists created own code subclas...

javascript - Build flat table from CSV files -

i have 500 csv files in format: indicatora_name.csv 1900 1901 1902 ... norway 3 2 sweden 1 3 3 denmark 5 2 3 ... indicatorb_name.csv 1900 1901 1902 ... norway 1 3 4 sweden 1 2 iceland 1 6 3 ... years in columns, countries in rows. notice countries, years , values may differ between files. i'd run through these files , make flat table (csv file) structure: country, year, indicatora_name, indicatorb_name, ... sweden, 1900, 1, 1 sweden, 1901, 3, 2 norway, 1900, 3, 1 ... preferably in php or javascript i'm willing learn new. you should code following code: $file = file_get_contents('file.csv'); $lines = explode("\n", $file); //lines $years = explode(";", $lines[0]); //first line years, gives array of years for($i = 1, $c = count($lines)-1; $i < $c; ++$i){ //iterate on lines (excluding years)...

mysql - How do I employ user variables to select x records for each value of a given column? -

edit: i've discovered problem appears when use phpmyadmin execute query, , not when execute same query using php's mysql_query(). (my webhost not provide command-line access.) specifically, when run on table of 65k+ rows, phpmyadmin appears hang, mysql_query() returns expected result. i have table: products (product_id, shop_id, date) for each shop_id in table, following query retrieves 10 rows recent dates set @num := 0, @shop_id := null; select shop_id, date ( select shop_id, date, @num := if(@shop_id = shop_id, @num + 1, 1) row_number, @shop_id := shop_id dummy products order shop_id, date desc ) x x.row_number <= 10; for example, if there 10 distinct shop_ids, , each of these shop_ids appears in @ least 10 rows, query return 100 rows, 10 per shop_id. query works fine. in addition date , shop_id, select product_id each row. while following query works fine abut 55k rows, when try 65k rows, mysql appears hang indefinitely (at least php...

xcode - How to change #import "..." into #import <...> in Objective C -

i have problem library. want add objective c (ios) project, docs don't how that. copied over. main file has this: #include <lib/class1.h> #include <lib/class2.h> ... it didn't work me, changed each <> "": #include "lib/class1.h" #include "lib/class2.h" ... and syntax works fine, can use lib. guess it's not practice, though. how should add library project works without modification? in xcode build setting, header search paths (header_search_paths) affects search path of #include <foo.h>, user header search paths (user_header_search_paths) affects search path of #include "foo.h". so, set header_search_paths library's header path, #include <lib/class1.h> should work. also, search user paths (always_search_user_paths) setting can change behavior search path #include <foo.h>. when always_search_user_paths yes, #include <lib/class1.h> should work well.

rubygems - apn_on_rails breaking view helpers on rails 2.3.8? -

i developing rails application should send push notifications ios devices. using apn_on_rails gem. works fine in rails console. when run server, undefined method errors basic view methods such content_for or form_tag etc: when take require 'apn_on_rails' development.rb out, views work again, of course without push notifications. here example trace: processing dashboardcontroller#index (for 127.0.0.1 @ 2011-02-27 13:55:59) [get] user load (0.2ms) select * "users" ("users"."id" = 1) cache (0.0ms) select * "users" ("users"."id" = 1) rendering template within layouts/dashboard rendering dashboard/index actionview::templateerror (undefined method `content_for' #<actionview::base:0x103343970>) on line #1 of app/views/dashboard/index.html.erb: 1: <% content_for :header %> 2: <%= render :partial => "header", :locals => {:title => "dashboard"} %> 3: <% ...

c# - Very fast and light web call, which technology to use: legacy web service or HttpWebRequest -

i need insecure, fast, light , easy implement web method. this: // client side // parametrize client address dynamic , don't know until run-time myclient.address = "http://example.com/method.aspx/?input=" + value; string result = ""; if (myclient.trycallwebmethod(out result)) // web method succeed. use returned value. else // web method failed. no problem, go plan b. // server side response.write("answer is: " + request.querystring[input]); i know reconstructing wheel, need simple above code. can implement client httpwebrequest maybe using legacy web service better choice. i have tried wcf there more choices don't need sessions, security, etc. did localhost benchmarking , wcf came it's knees @ 200 concurrent requests, need support of more 1000 concurrent calls normal load aspx page. this web method gonna consumed asp.net page. never used legacy web service, ok scenario or wcf has dozen of configurations , certificate...

php - Google Weather API - parsing and modifying data -

this question no longer up-to-date -- google shut down unofficial weather api in 2012 i'd put weather forecast friend's web page. when address for http://www.google.com/ig/api?weather=koprivnica,croatia&hl=hr the browser returns right content i'd parse php code: <?php $xml = simplexml_load_file('http://www.google.com/ig/api?weather=koprivnica,croatia&hl=hr'); $information = $xml->xpath("/xml_api_reply/weather/forecast_information"); $current = $xml->xpath("/xml_api_reply/weather/current_conditions"); $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions"); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title...

css - When printing page table rows/cells gets split on page break -

i have table nested tables in. when printing page, cells gets split on page break. is there chance can control should jump onto next page instead of splitting middle? you can have @ page-break-before css property. example can set auto on each of cells. bur can't guarantee work, each navigator prints little differently. firefox known have problems printing big tables (more page) example.

java - Facebook SDK for Android "An error has occurred with MyApp. Please try again later" -

i error time reason when working fine , posting wall days before. my expiration token believe set unlimited out of ideas why randomly stop working. does else have/had ? can fix ? 110 error_code = missing user cookie (as in jamie's comment) for me, came in app when logged out of ' facebook ' app cleared cookie (after prompting confirmation). now, coming app, facebook object still holds stale ' access_token ' , previous session data. i got around this, trapping ' 110 ' error after ' post_id ' returned ' null '. if found, ' logout ()' , ask re-login hold of new ' access_token ' before posting new messages.

c# - Need help optimizing loop with Linq -

disclaimer: have little experience linq. one of tasks @ work maintain e commerce web site. yesterday, 1 of our customers started complaining of timeout occur when tried create feed file google. turns out, if user has more 9,000 items put in feed file, our code takes @ least 1 minute execute. i couldn't find source of problem running debugger, fired profiler (ants) , let thing. found source of our problem, foreach loop contains bit of linq code. here code: var productmappings = googleproductmappingaccess.getgoogleproductmappingsbyid(context, productid); list<google_category> retcats = new list<google_category>(numcategories); int added = 0; //this line flagged profiler taking 48.5% of total run time foreach (google_productmapping pm in (from pm in productmappings orderby pm.mappingtype descending select pm)) { if (pm.googlecategoryid.hasvalue && pm.googlecategoryid > 0) { //this line flagged 36% of total time retcats.add(...

cocoa - Am I using BeginSheet right? (MonoMac) -

i have feeling i've either stumbled upon bug (unlikely) or i'm using function wrong (probably). i'm trying make sheet appear on mainwindow. reason though, sheet window pops regular window without toolbar , in no way connected mainwindow @ all. now i'm pretty new cocoa , monomac you'll have forgive me, anyways, heres code: tvshowsheetcontroller sheet = new tvshowsheetcontroller (); nsapplication.sharedapplication.beginsheet (sheet.window, window); what doing wrong here? aha! setting sheet's window property "visible @ launch" false solved problem :)

bundler - RoR - installing gem - libxml-ruby-1.1.4 -

i'm trying install libxml-ruby-1.1.4 (via bundler, same thing happens when gem install) , huge list of errors. i'm running mac osx 10.6 on unibody macbook. the errors start after make , have lot of darwi errors , long list of ruby_xml_error … undeclared (first use in function). here pastie of errors. please help. in order others searching issue here of common phrases showing in errors. /system/library/frameworks/ruby.framework/versions/1.8/usr/bin/ruby extconf.rb -i/system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -i. -i/usr/local/include -druby_extconf_h=\"extconf.h\" ruby_xml_error ... undeclared (first use in function) xml_(blah) (no such file or directory) make: * [ruby_xml_error.o] error 1 so i'm not 1 issue . common problem old version of libxml2. brew install libxml2 and make sure libxml2 bin in path.

MySQL fill the memory and freezes -

i have problem mysql server (debian/lenny). mysql daemon fill memory , pages not accesible. restart of mysql daemon helps, have restart whole server (can't connect ssh anymore). here error log: innodb: error: pthread_create returned 12<br/> 110228 23:58:36 innodb: started; log sequence number 0 43695 110228 23:58:36 [note] /usr/sbin/mysqld: ready connections. version: '5.0.51a-24+lenny5' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (debian). edit problem is, i'm not using innodb engine. tables in myisam engine. show engines says: no innodb. did before. here my.cnf [client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket=/var/run/mysqld/mysqld.sock nice = 0 log-error = /var/log/mysql/error.log [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp l...

ruby on rails - How to handle the AuthenticityToken value using a HTTP POST request from a RoR application to another RoR application? -

i using ruby on rails 3 , know how handle authenticitytoken value using http post request ror application ror application. in case aim submit sign in form , return user information in json format if he\she provided correct email , password values. i have ror application @ url pjtnam.com and ror application @ url users.pjtname.com if make http post request application pjtname.com application users.pjtname.com (in example use typhoeus gem ) response = typhoeus::request.post("http://users.pjtname.com/authentications", :params => { :new_authentication => { :email => email, :password => password } } ) i response <h1> actioncontroller::invalidauthenticitytoken in authenticationscontroller#create </h1> <pre>actioncontroller::invalidauthenticitytoken</pre> so, how handle authenticitytoken value in safe approach\mo...

jquery - Price calculation, comma, and conditional statement -

all sorts of topics dedicated european comma problem, i.e. how change ',' '.', i've not found solution mine yet. i want users able input in comma-value manner (e.g. 3,99 ), calculate stuff , output of again in comma's. if-statement should mention if price @ end (earnings) turns negative, turns red (i.e. not possible). i able change point comma , output that, other way around i'm dazzled. here's code far: i've managed whole thing working based on @zirak's comments , little bit of me-magic, see code below! function dollarformat(num) { num = num.tostring().replace(/\u20ac/g, 'euro'); if(isnan(num)) num = "0"; cents = math.floor((num*100+0.5)%100); num = math.floor((num*100+0.5)/100).tostring(); if(cents < 10) cents = "0" + cents; (var = 0; < math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length...

Capture Pin property window in Directshow c# -

i'd grab samples video stream sample grabber capture device. works default 640*480 resolution. i've seen few examples codes (for reason cant seem open these thats why i'm asking) possible change properties of capture pin when selecting capture device in property window , i'd replicate aswell. give advice concerning this? thanks. ask pin iamstreamconfig interface, allow list available video modes , select desired one. can test in grapheditplus right clicking capture pin , selecting iamstreamconfig::getstreamcaps or iamstreamconfig::setformat.

c# - Iteration in Xmldocument -

<root> <person name="tom"> <car name="car1" /> <car name="car2" /> </person> <person name="sally"> <car name="car3" /> <car name="car4" /> </person> </root> i using selectnodes() method traverse. having trouble itterating 2 levels down names of cars. var people = xmldoc.selectnodes("/root/person"); foreach (xmlnode person in people ) { var cars = person.selectnodes("/car"); foreach(xmlnode car in cars) { //get name of car } } the statement person.selectnodes("/car") not return results. remove / xpath when selecting car

c# - Invalid Resx file. Could not load type System.Collections.Generic.List -

i have property on usercontrol when add usercontrol foem , want run, got error on visual studio 2010 error dosn't appear on vs 2008: "invalid resx file. not load type system.collections.generic.list...." [serializable] public class actionpoint { public string carinfo; public string rightstationname; public string rightstationinfo; public string leftstationname; public string leftstationinfo; public actionpoint() { } } public class line : usercontrol { public list<actionpoint> stations { { return stations; } set { stations = value; } } } if check in resx-file, have data section? i have no idea happened worked me remove 2 data sections binary (serialized) data stored: <data name="mylistview1.datasource" mimetype="application/x-microsoft.net.object.binary.base64"> <value> aaeaaad/////aqaaaaaaaaamagaaajybu2tvbgvwb3j0zw5bzgrpbiwgvmvyc2lvbj0xljaumc4wlcbd dwx0dxjlpw5ldxryywwsifb1ymxp...

form select menu using php to jump to a page but goes into infinate loop -

(have ammended question show redirect code) i using select menu in simple form bus tours site allow users select option , have new page load using php based on select. works fine if user clicks submit when first value selected eg 'select bus tour' should go instead seems go loop. firefox gives error: http://hairycoo.nsdesign7.net/tour// here form code: $thistour = new tour($_get['id']); $tourdata = $thistour->getdata(); if ( !isset($_get['pagetile']) ) { ob_get_clean(); header('location: /tour/'.urlencode($tourdata->tours_title).'/'.$_get['id']); exit(); } thanks! paul your site seems stuck in redirect loop, went url , there nothing see. suspect may issue: if have page redirecting in absence of required $_post value, make sure if $_post data present. $_post data expire after first redirect. example: if ( ! empty($_post)) // <--- make sure there post data { if ( ! isset($_post['some_required_...

What is the best way to store dates in MongoDB? -

i starting learn mongodb , hoping migrate mysql. in mysql, there 2 different data types - date ('0000-00-00') , datetime ('0000-00-00 00:00:00') . in mysql, use date type, not sure how transfer them mongodb. in mongodb, there date object, comparable datetime . seems appropriate use date objects, wasting space, since hours, min, sec not utilized. on other hand, storing dates strings seems wrong. is there golden standard on storing dates ('0000-00-00') in mongodb? bson (the storage data format used mongo natively) has dedicated date type utc datetime 64 bit (so, 8 byte) signed integer denoting milliseconds since unix time epoch. there few valid reasons why use other type storing dates , timestamps. if you're desperate save few bytes per date (again, mongo's padding , minimum block size , worth trouble in rare cases) can store dates 3 byte binary blob storing unsigned integer in yyyymmdd format, or 2 byte binary blob denoting "...

jquery - jScrollPane: Margin issue -

Image
strugglig bit seems margin issue jscrollpane. tried setting margin: 0 pretty on every element that's inside jsp , on actual jsp elements. i'm attaching picture show issue. problem small black stripe between content , actual scrollbar. css classes inside jsp width: 100%; min-height: 60px; max-height: 300px; margin: 0; padding: 0; css jsp .jspcontainer { overflow: hidden; position: relative; } .jsppane { position: absolute; } .jspverticalbar { position: absolute; top: 0; right: 0px; width: 5px; height: 100%; background: url('../img/stafful.png') repeat; } .jsphorizontalbar { position: absolute; bottom: 0; left: 0; width: 100%; height: 16px; background: red; } .jspverticalbar *, .jsphorizontalbar * { margin: 0; padding: 0; } .jspcap { display: none; } .jsphorizontalbar .jspcap { float: left; } .jsptrack { background: transparent; position: relative; } .jspdrag { ba...

internet explorer - Output all form variables in javascript (similar to php's print_r()) -

i'm looking output form names , associated variables in alert box me debug something. i'd use firebug or whatever problem exists on ie (and ie developer tools don't seem helpful in case.) i'm guessing need loop i'm not sure how provide array of form keys.. thanks, john. using json + jquery: var formobject = {}; $('form input, form textarea, form select').each(function(){ formobject[$(this).attr('name')] = $(this).val(); }); alert(json.stringify(formobject)); edit: in action http://jsfiddle.net/rapvf/ note: ie 7 , below need include json2.js

c# - How to bind each GridViewColumn to a separate ObservableCollection? -

firstly using listview control itself: itemssource="{binding alleffects}" so not allow individual binding per gridviewcolumn ? besides alleffects have 2 other observablecollection want bind 2 other gridviewcolumn : public observablecollection<gpusupportnode> gpusupport { get; set; } public observablecollection<cpusupportnode> cpusupport { get; set; } public class cpusupportnode { public bool issupported {get;set;} } i trying hook these 2 gridviewcolumns gpusupport/cpusupport .issupported respectively. right have: <gridviewcolumn width="auto" header="gpu"> <gridviewcolumn.celltemplate> <datatemplate> <checkbox margin="0" horizontalalignment="center" ischecked="{binding gpusupport, mode=twoway}"/> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn...

ruby on rails - Guid column in model, what is the migration? -

i want create column/property in model guid? what migration this? here example storing guid in string: http://railsforum.com/viewtopic.php?pid=104690#p104690 ( unique_identifier in migration should renamed uuid concord model validations).

vb.net - how to connect visual basic .net with microsoft exchange with free libraries posible? -

are there free libraries vb.net use connecting ms exchange server? have found paid ones i'd rather not invest, couln't find free libraries.. tried using java protocol layer mapi wouldn't work what trying accomplish? i've had no trouble sending mail via exchange account using regular smtp client public shared sub sendemail(byval sfromaddress string, _ byval stoaddress string, _ byval ssmtpaddress string, _ byval susername string, _ byval spassword string, _ byval sorderno string, _ byval surl string, _ byval iport integer) try dim client new smtpclient(ssmtpaddress, iport) client.usedefaultcredentials = false client.credentials = new system.net.networkcredential(susername, spassword) client.enablessl = true dim m...

iphone - How to recognize tap on imageView when it on Table View (Custom Cell)? -

hwy buddy try make album view put 3 imageview on custom cell after set images can`t tap on image.... if can tap/touch image saw particular image on new view , make photo album application.... please me..... thanks in advance.... why not make them uibuttons instead of uiimageviews? same can attach event handlers them in interface builder (or in code if want).

CakePHP: How does a form still have your data in it when it doesn't validate? -

when create form element cakephp so: echo $this->form->input('user.first_name'); you start blank field. when put in name john , submit form, if form not validate, name john still there when return page fix validation errors. convenient because can fix mistakes without having retype parts got right. how put value? i need know because once form submitted , leave page , come form blank again. i saving name session can instead: $first_name = $this->session->read('cart.user.first_name'); echo $this->form->input('user.first_name',array('value'=>$first_name)); now if lave page , come back, name still there breaks original logic preventing putting type in when form fails validate. let me give example. i creating name element like: $first_name = $this->session->read('cart.user.first_name'); echo $this->form->input('user.first_name',array('value'=>$first_name)); i fill out f...

API for powerpoint presentations to flash -

how go automating conversions powerpoint flash? want user able upload powerpoint file web page , on server want convert powerpoint flash movie. there preferred method doing this? i've searched on google , keep getting lot of 3rd party software vendors selling addon software can't seem find useful guides or tutorials doing this. there 2 (decent) solutions know of - first being little more decent second. ispring offers free version of powerpoint flash converter called ispringfree . it's decent. use pro version because have need add e-learning/scorm functionality - if don't have need, should fine. in general, 1 of better converters out there (amongst host of many pay-for ppt->swf converters). you open ppt/pptx in openoffice.org 's impress , export flash format. having server-side triggered conversion little more tricky - don't know of server-side component other pay-for sdk solution ispring offers this. 2 above manual conversion.

vb.net - Find file creator in vb? -

is there way creator of file using vb8? can't seem find work. need find creator of each file in directory of hundreds of files. you can try file owner dim fs filesecurity = file.getaccesscontrol("somefilename.ext") dim sid identityreference = fs.getowner(gettype(securityidentifier)) dim ntaccount identityreference = sid.translate(gettype(ntaccount)) dim owner string = ntaccount.tostring()

Strange top margin in other cells when IMG tag is first in a CSS table cell -

i have noticed bug several times when programming , wonder if has work around. when create css table using display:table property, if 1 of cells contains img first element, text in adjacent cell begins below image's height. if put text before image tag, text in next cell displays normally. i have noticed if display property of img block, text in next cell begins below image, if img set display:inline, text next door aligns it's baseline baseline of image. ideally, content begin @ top of each cell, , start column image. when create css table using display:table property you're having problem because default vertical-align baseline div s (which assume you're using). to fix it, specify vertical-align: top on whatever has display: table-cell .

scripting - Vim script: Buffer/CheatSheet Toggle -

i want make vim cheat sheet plugin. it's real simple: i want toggle cheatsheets. vertsplit toggle, taglist or nerdtree. i want cheatsheet filetype specific. toggle c++ cheatsheet when have opened .cpp file. i want cheatsheet horizontally split. shows 2 files, syntax cheat sheet , snippet trigger cheat sheet. i have collection of these cheatsheets, in vimhelp format, have manually open them. i haven't done vim scripting, imagine simple put together. i'm sorta sick of googling unrelated codesnippets, i'm asking here is: could give me short sum-up of need learn in regards vim scripting piece together. have hard time finding how toggle buffer window. if know intro tutorials covers material need , running, please provide link. tx, aktivb the function below may not want, , haven't tested it, should give ideas. the main idea function reads filetype of current buffer (you can test typing :echo &ft ) , sets path of appropriate cheat shea...

ruby on rails - Create nested records on put/post with accepts_nested_attributes_for -

i have 2 models, landscape: class landscape < activerecord::base has_many :images, :as => :imageable accepts_nested_attributes_for :images, :allow_destroy => true attr_accessible :id, :name, :city, :state, :zip, :gps, :images, :images_attributes, :address1 def autosave_associated_records_for_images logger.info "in autosave" images.each |image| if new_image = image.find(image.id) new_image.save! else self.images.build(image) end end end end image: class image < activerecord::base belongs_to :imageable, :polymorphic => true end i'm sending post , put requests iphone update/create landscape record json. here's example post request create new landscape record , new associated image record { "landscape":{ "id":0, "name":"new landscape", "city":"the city", "state":"la", "zip...

maven - Why does Nexus repository doesn't download the required artifacts when using a group repository? -

i use nexus repository manager , configured default .../nexus/content/groups/public/ repository , added maven central, codehaus snapshot , internal respository created , have uploaded few artifacts that. then added .../nexus/content/groups/public mirror in settings.xml. when maven build, maven looks in .../nexus/content/groups/public not update org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-6 , reports not found. but if remove mirror settings.xml, looks in http://repo1.maven.org/maven2/ , picks artifacts correctly. i have changed publish url true. miss? if added repositories proxy repositories in nexus not forget add proxies repository group use mirror nexus requests (public/snapshot) - assumed have kind of configuration.

javascript - jquery slideshow using background images -

i have div has static background image. i need create slideshow of background images div. i able achieve setting timeout , changing background image in css not elegant. i ideally fade background images out , in, div contains other page elements can not alter opacity in way. does know of way using jquery?? here's code fades out/in fades out contents of div too. $("#slideshow").fadeout(5000, function(){ $("#slideshow").css('background-image','url(myimage.jpg)'); $("#slideshow").fadein(5000); }); html: <div class="slideshow"></div> css: .slideshow { position: relative; width: 350px; height: 150px; } .slideshow img { position: absolute; width: 350px; height: 150px; z-index:-1; } jquery var images=new array('http://placehold.it/250x150','http://placehold.it/250x150/123456','http://placehold.it/250x150/dbca98'); var nextimage=0...

using jquery .ajax or .get to receive content from database via php script -

i have php script communicate mysql right now, , displays in tab number 2: $res = mysql_query("select k_id, title headings match (title) against('$kquery') order match (title) against('$kquery') desc"); while ($result = mysql_fetch_array($res)){ $kid= $result['k_id']; echo "<h1>{$result['title']}</h1>"; $content = mysql_query("select content, url, id kparagraphs k_id = '$kid' limit 3"); while ($con = mysql_fetch_array($content)){ echo $con['content']; } } what i'm doing selecting/loading content database in tab number one. wanted content displayed in tab number 2 being loaded via ajax. how in jquery php? how pass data file ...the php script starts $kid = $_get['title']....title enocoded in url. how can pass along using mentioned answer uses .load? 1.) create page want loaded via ajax using code above...

paging - Alternative to niceload command in ubuntu? -

i'm looking alternative niceload utility in ubuntu. there utility niceload available (apt-get install ...) in distribution ? to more specific i've ran problem when running several (8) number crunching processes on box. 1 of these processes requires lot of memory (~10gb, few minutes). system have 24gb of memory. need prevent more 2 processes simultaneously running in 'high memory load' mode. otherwise i'm running heavy swapping , system pretty freezes. it looks niceload utility trick, not supereasy install in ubuntu (it part of gnu parallel). there alternative in ubuntu readily available? there ubuntu package of gnu parallel here: https://build.opensuse.org/package/binaries?package=parallel&project=home%3atange&repository=xubuntu_10.04 the new release has --start-mem , --noswap seems looking for.

OpenGL ES1, imported blender texture not resizing in oolong/iphone -

just had simple question opengl es couldn't find answer to. trying display simple meshes made in blender using oolong3d's blenderparse example, when import textures blender stay same size. mean in blender can resize texture fit mesh, when import them in opengl size stays same , don't fit whole mesh. here link pics , code used apply textures: http://img17.imageshack.us/g/blenderview.png/ . there missing code need accomplish this? edit mesh in edit mode (to go edit mode , select mesh , press tab ).

android - PopupWindow padding - too large -

Image
i have popupwindow using in activity , , works fine except padding of elements contained within popupwindow - it's large - literally taking of small popupwindows space. here xml use define popupwindow : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/homescreen_popup_bg_levels"> <textview android:id="@+id/x" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="#ff000000" android:textsize="12dp"> </textview> <textview android:id="@+id/y" android:layout_width="match_parent" android:layout_height="wrap_content" android:textsize=...

Android - Sending audio-file with MMS -

im using following code send audio-files through email, dropbox +++.. not giving me option send same file through mms.. know how attach mms , let user send if he/she wants? intent share = new intent(intent.action_send); share.settype("audio/3gpp"); share.putextra(intent.extra_stream, uri.parse("file://" + afile)); startactivity(intent.createchooser(share, "send file")); you can used code.. intent sendintent = new intent(intent.action_send); sendintent.setclassname("com.android.mms", "com.android.mms.ui.composemessageactivity"); sendintent.putextra("address", "9999999999"); sendintent.putextra("sms_body", "if sending text"); final file file1 = new file(environment.getexternalstoragedirectory().getabsolutepath(),"downloadtest.3gp"); uri uri = uri.fromfile(file1); se...

Scalatra - how do we do an internal redirect / forward of request -

i want call internal url scalatra 'controller'. can't simple redirect, there's security settings mean user has access first url. is there way this? get("/foo") { servletcontext.getrequestdispatcher("/bar").forward(request, response) }

sql - Proper MySQL way to add a column from one table to another -

i have large table (~10 million records) contains several keys other, smaller tables. keys unique in each of smaller tables not in large one. add column large table 1 of smaller tables based on keys matching, i'm not sure of "right" way it. have solution works, takes fair amount of time (thought may unavoidable) , doesn't feel it's optimal way it. here's have: create table new_big_table big_table; alter table new_big_table add(new_column tinyint not null); insert new_big_table select big_table.*, smaller_table.my_column big_table join smaller_table on big_table.key1 = smaller_table.key1 , big_table.key2 = smaller_table.key2; this gets job done, smells i'm doing wrong. seems @ minimum shouldn't need create duplicate of table done. there more direct (and more efficient?) way of doing this? it might worth mentioning personal, hobby project @ home, free hog resources of machine (since i'm 1 using it). such, if there straightforward...

javascript - Firebug issue - "this.Z.isActive is not a function." -

the code below 1 line i'm having trouble with. everytime try load youtube's advanced video uploader firebug(because upload fails if don't use breakpoint) stops loading , says "this.z.isactive not function" how fix this? i'm noob @ script stuff, please go easy technical terms, lol. var xh = function (a) { var b = "java_uploader_" + zh++, c = ee(document.body), d = c.c("applet", { id: b, archive: a.o, code: "com.google.uploader.service.client.applet.uploaderapplet", width: a.pc, height: a.pc, style: "position: absolute; top: -" + a.pc + "px; left: -" + a.pc + "px;" }); ah(a, new za("appletloadstart", a)); c.appendchild(document.body, d); a.z = d; a.ma.info("inserted applet dom id: " + b); ah(a, new za("appletindom", a)); a.ge = window.setinterval...

php mysql timestamp - a few questions -

i have products table i've added new field use timestamp. i'm not sure if should bigint field or timestamp field though. what's difference , offer best performance? i want compare current date timestamp value , if difference greater x days (meaning product no longer available) exclude product query results. i've never used timestamps before , need kick-start understand usage, thanks. to store time in mysql down second may choose between timestamp datetime their relationship discussed here . but make long story short, timestamp integer , is, if no value provided, automatically set. it's choice if want store time of last insert example. datetime has set explicitely , "optically" string of format 'yyyy-mm-dd hh:mm:ss'. mysql processes both fast, ts isn't faster b/c it's integer. especially if want operate on time beyond <,>,= i'd recommend datetime. there lot of functions available.

java - Check for previous and next entry in SQLITE -

i have android application uses sqlite database. app has next , previous button view entries in database. need check whether or not next or previous entry exists way can disable button if 1 not exist. run query ids of each record in table , cache this. know if there next or previous entries. click button, , app primary key lookup based on cached data.

hibernate - Is it possible to query like this? -

code class member{ string name } class group{ string name static hasmany = [member: member] } //controller def member = member.get(1) // member object expected def group = group.findbymember(member) //error question it not possible find group this.... (since group , member in 1 many relationship) is there other simple way? solution here: http://adhockery.blogspot.com/2009/06/querying-by-association-redux.html solution here: def group = group.withcriteria { createalias("member", "m") eq("m.id", 1) } source http://adhockery.blogspot.com/2009/06/querying-by-association-redux.html

c# - textbox or any control id keep on changing, why? -

for textbox, following id generated on local. ctl00_contentplaceholder1_uclogin1_txtusername when hosted on iis, following id got generated. contentplaceholder1_uclogin1_txtusername how can textbox id? don't reply answer use clientid , cos i'm using external javascript file. wont support clientid . if you're using asp.net 4.0 can set clientidmode of textbox static , id same. example: <asp:textbox id="txtusername" runat="server" clientidmode="static" />

navigationbar - How To Create Fixed Navigation Bar For All Activities In An Android Application -

i want set navigation bar ( 2 buttons , textview ) common activities of application. know can done including common layout file each activity's layout file. have use slide transition animation when activity changes another. if follow common layout file including process, navigation bar slide in or out activity's view want navigation bar fixed when activities view slides in or out. besides, 2 buttons of navigation bar should set can hide them using code activities. need badly on problem, please give me solution/suggestion/clue on problem.thanks in advance ..... perhaps fragments may looking in scenario. or thinking further maybe viewflipper multiple layouts in case.

ruby on rails - js error when trying to dynamically update gmaps -

trying gmaps update in place once new location typed out. (anyone know tutorial actually? :p) anyways when running gmaps4rails.replacemarkerst method, seem bring js error seen when using chrome's inspection tool seen below. ideas? http://stuff.saikonet.org/images/misc/2011-07-22-030217_1024x768_scrot.png ok gotcha, problem not replace_marker function. indeed, using old document-ready buddy, google maps isn't yet created. yep failing. that's gmaps4rails.callback makes it's entry. after declaration of map (for obvious reason: gmaps4rails must defined): <% content_for :scripts %> <script> gmaps4rails.callback = function() { gmaps4rails.replacemarkers([{"lng": "-92.5294574", "lat": "45.1969796"}]); }; </script> <% end %>

javascript - How to Go To Next HTML element using Java Script -

suppose have basic html page 5 text box , 1 button @ end. now want go next html element , let's next textbox (same tab does), on press of key code 412 , on press of key code 417 , should able go previous element( same shift + tab ). now can not use tab or can tab key absent on key board. help. well code detect key press below: document.onkeyup = keycheck; function keycheck() { var keyid = event.keycode; document.form1.keyname.value = event.keycode; switch(keyid) { case 412: document.form1.keyname.value = "rewind prseesd"; break; case 417: document.form1.keyname.value = "forward pressed"; break; .................... } now want next , prev on key code 412 , 417 first, build array elements in desired order: var _arrelements = [ "myinput1", "myinput2", "myinput3" ]; second, change code detect textbox key pressed, find id in array , focu...

matlab - How to embed combine images together -

is possible transformation unction fourier etc combine more 1 image file(3d) 1 file digital album. combining of files should reversible operation such individual images can separated. i attempted sure nothing close should be: img1=imread('lena_gray.jpg'); img2=imread('pic1.jpg'); img3=imread('pic2.jpg'); defimage=pow2(get(0,'defaultimagecdata'),47); mag=200; imshow(bitslice(defimage,47,51),'initialmag',mag); r=bitslice(img1,50,50); g=bitslice(img2,50,60); b=bitslice(img3,100,100); imshow(cat(3,r,g,b),'initialmag',mag); this results error! also, how achieve reverse operation? cramer's rule of inverse in demultiplexing combined images? if so, how operate cramer's rule on rgb images? i think trying achieve multiplexing , demultiplexing. try fresnel transform instead of fourier

mysql - gem install mysql2 fails -

i got error: sudo gem install mysql2 building native extensions. take while... error: error installing mysql2: error: failed build gem native extension. /usr/bin/ruby1.8 extconf.rb checking rb_thread_blocking_region()... no checking mysql.h... no checking mysql/mysql.h... no ----- mysql.h missing. please check installation of mysql , try again. ----- *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby1.8 --with-mysql-config --without-mysql-config gem files remain installed in /var/lib/gems/1.8/gems/mysql2-0.2.6 inspection. results logged /var/lib/gems/1.8/...

cocoa - how to match string portion with NSArray values in objective-c -

i have following array , search string. nsarray *values =[nsarray arraywithobjects:@"abc",@"xyz",@"cba",@"yzx",nil]; nsstring *search = @"startcba"; i want search string's end part within array elements. expected search result @"cba". please let me know how find desire value in array giving search. thanks, you can use nspredicate elements satisfy requirement. nspredicate * predicate = [nspredicate predicatewithformat:@" %@ endswith self ", search]; nsarray * searchresults = [values filteredarrayusingpredicate:predicate];

perl5 - Perl - pass code block as parameter inside parentheses -

is possible pass block of code sub using "parentheses" syntax? i.e. when write list::moreutils::any { defined ($_) } (undef, undef, 1); it works. when try add parentheses list::moreutils::any ( { defined ($_) } , (undef, undef, 1) ); this interpreted anonymous hash, giving error message. neither escaping nor using eval helps. the idea behind fuss if call part of expression, i.e. if (first_index { defined (${$_})} $jms_positions > $jms_positionals_seen ) some operator following arguments might executed before call, producing undesired result. an anonymous subroutine declared syntax sub { "the sub no name!" }; perl's prototype system allows special exception code block first parameter, in case can leave off leading sub , pass block, similar perl builtin. works when calling in parentheses-less style. using parens causes parser think want pass hash-ref. so can list::moreutils::any( sub { defined }, undef, undef, 1 ); if ins...

How to brings the Entity Framework Include extention method to a Generic IQueryable<TSource> -

here's thing. i have interface, , put include extension method, belongs entityframework library, irepository layer wich dont needs knows entityframework . public interface irepository<tentity> { iqueryable<tentity> entities { get; } tentity getbyid(long id); tentity insert(tentity entity); void update(tentity entity); void delete(tentity entity); void delete(long id); } so have extension method: public static class includeextension { static iqueryable<tentity> include<tentity>(this iqueryable<tentity> query, string path) { throw new notimplementedexception(); } } but don't know how implement in layer, , send entityframework (or whatever implement irepository) deal with. i need same interface extension method. any light? this question bit old, here 2 ef-independent solutions if or else still looking: 1. reflection-based solution this solution .net framework fall...

c# - Reference of an object to a Session property -

i have text box in aspx page, created session property (textbox type), then: textboxinsession = mytextbox; if change text property in textboxinsession, text property in mytextbox not changed. isn't textboxinsession reference mytextbox? in general, should not persist ui elements/controls session or application state. when store object instance, pin , holds reference in memory. because asp.net creates new instance on each page execution, can result in considerable amounts of memory being consumed non-garbage-collectible page , control instances, if make heavy use of technique. you should store value types, strings , serializable pocos or business layer types instead, , rebind them ui controls when need them.

Android ant run-tests artifacts -

when ant run-tests on android test project runs fine , can see summary of tests run , failures. there more detailed information available, log file can save on each test run? want able run tests command line , each run have list of failures/passes detail possible plus capture logcat (but guess have manually). thanks you might want take @ android junit report test runner: https://github.com/jsankey/android-junit-report

ruby on rails 3 - Programmatically invoking active_record generator: how to pass the parent argument? -

the parent argument ignored, in of these cases: rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], ["parent=ecm::toplist::base"]]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], ["--parent=ecm::toplist::base"]]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], "parent=ecm::toplist::base"]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], "--parent=ecm::toplist::base"]) is bug, or missing something? correct way be rails::generators.invoke("active_record:model", [name, "list_order:string", "name:string"], { parent: "ecm::toplist::base"}) but careful, according this once specify :parent, migration ...

ruby - ActiveRecord and might belongs_to -

i have pair of data types every x may have many y , , each y has @ 1 x . in database, i'd visualized as create table xs ( id integer not null primary key ); create table ys ( id integer not null primary key, x_id integer foreign key references xs (id) -- may null ); using activerecord, it's easy me every x has_many y , how express every y has @ 1 x ? impression belongs_to work, i'm not sure how it'll situation when x_id null . you're right. y should have belongs_to :x . if x_id not present, y.x return nil . having belongs_to doesn't mean if value not present, blow up.

c# - Using a BizTalk orchestration to call .NET class library to read xml when there is new xml file in the directory -

i have set receive message , receive port monitor xml files. added expression shape execute .net class library using system.diagnostics.process.start (@"c:\temp\xmlreader\xmlreader\bin\release\xmlreader.exe"); when deploy biztalk, new file gets received on receive location, file disappears , nothing happens. have other orchestration project receive , send port file disappears , not move send location i not sure following logic. however, assuming have correctly set subscription between orchestration , message published receive port. by time orchestration activated, original file system xml gone forever. in fact gone once receive location enabled , consumes it. if trying manually read original xml file off file system, orchestration, not successful. biztalk has pitfalls, when in doubt, stick incremental approach; create/enable receive port , location straight administration console (forget visualstudio now). pass in xml (or whatever) ...

MySQL to get the count of rows for each worker with specific dates and jobs -

i have database of workers , assigned work items. want create report using mysql show count of how many work items under jobs , within date ranges each worker has. resulting data this: today tomorrow next year worker | job1 job2 job3 | job1 job2 job3 | job1 job2 job3 bob | 4 0 1 | 1 2 0 | 5 10 3 i have 1 table following relevant fields: worker, date, jobtype, workitem each worker has multiple entries under same name, bob have multiple workitems assigned him, this: bob | 07/27/2011 | sandblasting | workitem001 bob | 08/30/2011 | mowing | workitem001 bob | 08/30/2011 | driving | workitem002 workitems can assigned multiple jobtypes. i wrote confusing loops multiple queries, ideally want write single, complex query accomplish this. possible? overview each day: select worker, date, job, count(*) count workitems group worker, date, job overview month/year: select worker, month(date) month, job, count(*) cou...

linq - Referencing outer SelectMany parameter from inner Select -

i thought had got work before, don't see it: discounts dictionary<parttype, double> . data list<parttype> . var d = discounts.keys.selectmany( k => data.where( l => l.parttypeid.equals( k.parttypeid ) ) ) .select( s => new { k, l } ); the error is, name 'k' (and 'l') not exist in current context. what want apply double dictionary matching parttypes in data. i suspect mean: var d = discounts.keys.selectmany( k => data.where(l => l.parttypeid.equals(k.parttypeid)), (k, l) => new { k, l }); ... it's hard tell without more information. honest looks want join, e.g. var d = discounts.keys.join(data, k => k.parttypeid, // key discounts.keys l => l.parttypeid, // key data (k, l) => new { k, l }); // projection 2 values

javascript - ontouchstart vs onmousedown -

i have div fixed width of 200px 250px. can make div content scroll nicely javascript (on mousedown) , down no problem in desktop browsers need able div scroll iphone/ipad (mobile touch screen divice). how can scroll div , down linked controls both desktop browsers , iphone/ipad (modile touch screens) is there jquery this? check out jquery mobile or sencha.

objective c - iphone game control help -

hi creating game whereby 2 actions happen enable button, upon first touch of button need "power" bar scroll , down , on second touch of button "power" bar stops scrolling , action happens. i have got stage button touchable, have no idea call "power" bar control in order search on how create this. the "power" bar traditional in game control sports game, need set "power" of golf shot based on when hit button. if you know name of type of control can more detailed search -or- you have sample code show how "power" bar can achieved gratefully appreciated you use simple progress bar (uiprogressview) have "animate" yourself. perhaps use repeating timer 20ms delay generate small up/down changes. more on uiprogressview: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiprogressview_class/reference/reference.html how initiate uiprogressview value?

c# - How to remove the System Menu in WPF? -

Image
according msdn page , if using window, disable control box in top left hand corner setting false. this: this.controlbox = false; the controlbox has maximize, minimize, restore , close options but since i'm using ribbonwindow instead of window, how disable control box in situation? this question related, i'm looking disable systemmenu time, not prevent alt+space. because (i think) action listener systemmenu in top left hand corner blocks clickable ui element in xaml. i should note not problem windows server 2003, when application opened in windows 7, systemmenu/controlbox interferes ui element in top left corner. additionally, i've found interfering system menu results in buttons in top right hand corner of application being deactivated, don't want happen. thanks link eammonn. think person trying disable [x] button in top right hand corner, not menu in top left hand corner, wrong. reason don't think it'll work they're using <window x:cla...

mysql - What's is better for a members database? -

hi , thanx reading post having little trouble learning database in mysql. have set recently, had person tell me members table slow , useless if intend have lots of members! i have looked on lot of times , did google searches don't see wrong it, maybe because new @ it? can 1 of sql experts on , tell me whats wrong please :) -- -- table structure table `members` -- create table if not exists `members` ( `userid` int(9) unsigned not null auto_increment, `username` varchar(20) not null default '', `password` longtext, `email` varchar(80) not null default '', `gender` int(1) not null default '0', `ipaddress` varchar(80) not null default '', `joinedon` timestamp not null default current_timestamp on update current_timestamp, `acctype` int(1) not null default '0', `acclevel` int(1) not null default '0', `birthdate` date default null, `warnings` int(1) not null default '0', `banned` int(1) not null de...