Posts

Showing posts from June, 2013

osx - Importing a distributed python package from Django view -

i working on django project need search results amazon product advertising api. i've used api in php working on first django app. have signed , have amazon credentials, keys, secret keys, etc. as shortcut, found , installed distributed python package here: https://bitbucket.org/basti/python-amazon-product-api/overview question 1 : , how access non-django-specific python package within django? need add reference package in settings? package example docs include import statement, seems work in django shell (at least no error msg): >>>from amazonproduct import api >>> question 2 : when want send installed python package search query django view , template, how/where import package's objects? i have python package installed in same local instance of python django (running python 2.7 , django 1.5 on mac os x 10.8.2). i new both django , python. i've been able django models, views , templates working, , have of front-end scripting written parse ,

Reading from file Java null Object -

i write , read object file. below enclose code sample show idea (it sample, object more complex, problem same). my problem is: if don't make testobject field static, testobject.points becomes null on start of readobject method. don't understand why. give me explanation? i write 1 object, , 2 objects, , after read them (multiple object writing/reading - want create log file android). could me? // ... import public class testobject implements serializable{ transient public arraylist<point[]> points; public testobject() { points = new arraylist<point[]>(); point[] p1 = new point[1]; p1[0] = new point(1,1); point[] p2 = new point[2]; p2[0] = new point(2,2); p2[1] = new point(2,2); points.add(p1); points.add(p2); } private void writeobject(objectoutputstream stream) throws ioexception { stream.defaultwriteobject(); stream.writeint(points.size());

javascript - Native function [.sort()] not recognized inside event handler -

environment: seamonkey (firefox 20.0) i'm trying simple sort: either inside worker or inside postmessage handler. (all code samples inside top level (.html) file). works: function a() { var xyzzy = [40, 1, 5, 200]; xyzzy.sort(); }; fails : (error: typeerror: xyzzy.sort not function) var lrw0 = new worker('lrw0.js'); lrw0.onmessage = function (event) { var xyzzy = [40, 1, 5, 200]; xyzzy.sort(); }; after postmessage event handler has same context , scope did worker. fair enough. needless sort fails inside worker itself. seems if utility library cannot accessed? utterly defeated. have spent days on - no doubt reading solution somewhere without having understood it. contributions (including 'rude informative') gratefully accepted. appreciate necessity of mercilessly punishing newbies. neither of examples work until fix call array.sort method syntax array.sort([comparefunction]) javascript function a() { var xyzzy

JSON encode in bash -

is there better alternative doing: echo "{\"error\": \"must executed using user account 'admin'.\"}" >&2; in bash scripts? you try here document: cat <<eot {"error": "must executed using user account 'admin'."} eot this works unless have single line containing eot in text wish cat . if that's problem, can select alternate token, e.g. cat <<foo eot foo additionally, if find basic here documents resulting in unwanted expansion, e.g. cat <<eot foo$a eot will try expand $a , can quote here document token stop expansion: cat <<'eot' foo$a eot

How to run multiple lines using python -c -

i need use python -c remotely run code, works when use: python -c "a=4;print a" 4 or python -c "if true:print 'ye'" but python -c "a=4;if a<5:print 'ye'" generate error: file "<string>", line 1 a=4;if a<5:print 'ye' syntaxerror: invalid syntax what should make work, advice? enclose in single quotes , use multiple lines: python -c ' = 4 if < 5: print "ye" ' if need single quote in code, use horrible construct: python -c ' = 4 if < 5: print '\''ye'\'' ' this works because unix shells not interpret between single quotes—so have python code right until need single quote. since it’s uninterpreted, can’t escape quote; rather, end quotation, insert literal quotation mark (escaped, won’t interpreted start of new quote), , finally quote put uninterpreted-string state. it’s little ugly, works.

xaml - Slider control shows abnormal behaviour on {Binding} with TextBlock -

sorry if title weird , because problem kinda weird. i have textblock , slider control on clientside. the slider {binding} textblock. this code them - <textblock text="{binding value}" x:name="name1value" fontsize="25"/> <slider valuechanged="slider_valuechanged_1" x:name="slidervalve" value= "{binding elementname=name1value,path=text}" stepfrequency="25" /> now when slider value changes,slider calls method slider_valuechanged_1,which sends value server. server accepts value , sends new value client , new value server set textblock( x:name="name1value") through observablecollection inotifypropertychanged implemented. slider {binding} textblock. 1)now first time change value on slider on client, server accepts new value , returns new value , setting new value textblock. 2)now changing value on server , value correctly updated in textblock , slider value changes textbl

Flash/Actionscript 3 - embedded sound play/stop? -

how play/stop embedded music file in flash/as3 via button? this have: import flash.events.event; import flash.events.mouseevent; import flash.display.movieclip; import flash.media.sound; import flash.media.soundchannel; var mymusic:sound = new themesong(); var channel:soundchannel = mymusic.play(); startbutton.addeventlistener(mouseevent.click, onstartclick); stopbutton.addeventlistener(mouseevent.click, onstopclick); function onstartclick(event:mouseevent):void{ mymusic.play(); } function onstopclick(event:mouseevent):void{ mymusic.stop(); } themesong name of class assigned music file (import -> libraries -> properties -> export -> class name). startbutton , stopbutton identifiers buttons. if run i'll error saying: "scene 1, layer 'actions', frame 1, line 69 1061: call possibly undefined method stop through reference static type flash.media:sound." thanks. you're close flash wonky sometimes: import flash

php - Doubts about creating an specific query -

ok have database generate ticket code everytime users buy item. code have oportunity win price to win price have go register form, code ask.. thats data generated. ask name, mail address, , other non important stuff this part working nice , properly. need create o new function detect best buyers. when enter code participate , ask mail, have noticed, enters same mail each time register code. best way think select best clients, , interested on promotions also. so think best build query search mail row .. inside users table, , coincidences, , query can drop me list of "repited" mails in dsc order, is posible, can build query this? how? ok , thansk comments (why downvote??) anyway the structure is id | name | lastname | mail | phone | zipcode | birth | and sorry @ moment cant figure out query thats why ask. sorry been fool , how order number of times element occurs in table select count(*) top,mail,name lastname users group mail order top desc

linux - Bash doesn't create files in nested scripts -

when run first script calls second script no files created . however, when call second 1 directly same code appears on "echo" , it runs expected .' therefore, don't what's wrong, code runs separately. ./first_script.sh 2 ../espn first script: #!/bin/bash echo "$2/$1" > format.temp format=$(<format.temp) format=$format"g.t*" echo "./second_script.sh $format" ./second_script.sh $format here's code of second script (nested one): #!/bin/bash files=$1*/discover/*data file in $files sed 's/"\([^"]*\)"/"foo"/' $file > $file\_2 sed -i 's/"foo",//g' $file\_2 sed -i 's/[0-9]g//gi' $file\_2 sed -i 's/[^,.0-9]//g' $file\_2 done note-> files in folders: ../espn/2g.tf/discover/ ../espn/2g.tfidf/discover/ note-> files in folders: ../espn/2g.tf/discover/ ../espn/2g.tfidf/discover/ what mean?? first

java - Restriction on J2SE inbuilt method -

as per company rule can not use stop() of thread for want when use stop() , eclipse should shows error/warning difficult achieve using checkstyle , pmd. you have consider using findbugs instead of checkstyle or pmd, because need know runtime type of variable in order see whether instance of thread or not. afaik, none of tools has built-in detector/check thread.stop() rule, have write custom findbugs detector . a simpler way of achieving (but not suitable enterprise development environment) check occurrences of thread.currentthread().stop() , using checkstyle , regular expression. let me know in comments if example that.

want to display arrays of data in table using template file in perl -

i have different arrays of data stored sql : push( @bugid,$bug_id); push(@assign,$assignd_to); push(@stat,$stats); push(@res,$resol); push(@rat,$rate); push(@sev,$prior); push(@op,$o_p); push(@shrt,$shor_desc); $vars->{'bugid'}= \@bugid; $vars->{'ticket'}= $ticket_no; $vars->{'assigne'}= \@assign; $vars->{'stats'}= \@stat; $vars->{'resoltion'}= \@res; $vars->{'rate'}= \@rat; $vars->{'priorty'}= \@sev; $vars->{'opsys'}= \@op; $vars->{'shrtdesc'}= \@shrt; and have passed template file displaying purpose below : $template->process('reports/gayathri_old-ticketlist.html.tmpl', $vars) || throwtemplateerror($template->error()); and want display details in table . ie, corresponding each bugid , want display other fields. i have added code in template file.i got table format.but values entering each column in wrong manner. <table border='1' b

mysql - error while installing php from source -

im trying install php 5.3.x, while make im getting error im using centos. ext/mysql/php_mysql.o: in function `php_mysql_do_connect': /root/php-5.3.25/ext/mysql/php_mysql.c:965: undefined reference `_mysqlnd_init' /root/php-5.3.25/ext/mysql/php_mysql.c:982: undefined reference `mysqlnd_connect' /root/php-5.3.25/ext/mysql/php_mysql.c:846: undefined reference `_mysqlnd_init' /root/php-5.3.25/ext/mysql/php_mysql.c:855: undefined reference `mysqlnd_connect' /root/php-5.3.25/ext/mysql/php_mysql.c:903: undefined reference `mysqlnd_connect' ext/mysql/php_mysql.o: in function `zif_mysql_fetch_lengths': /root/php-5.3.25/ext/mysql/php_mysql.c:2266: undefined reference `_mysqlnd_fetch_lengths' ext/mysql/php_mysql.o: in function `zif_mysql_escape_string': /root/php-5.3.25/ext/mysql/php_mysql.c:1811: undefined reference `mysqlnd_old_escape_string' ext/mysql/php_mysql.o: in function `zif_mysql_get_client_info': /root/php-5.3.25/ext/mysql/php_mysql.c:

android - Application is not launching with FATAL EXCEPTION -

my application crashing while launching following error. 05-13 05:55:33.031: e/androidruntime(1022): fatal exception: main 05-13 05:55:33.031: e/androidruntime(1022): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.myphonecall/com.example.myphonecall.myphonecall}: java.lang.classcastexception: com.example.myphonecall.myphonecall cannot cast android.app.activity 05-13 05:55:33.031: e/androidruntime(1022): @ android.app.activitythread.performlaunchactivity(activitythread.java:2106) 05-13 05:55:33.031: e/androidruntime(1022): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 05-13 05:55:33.031: e/androidruntime(1022): @ android.app.activitythread.access$600(activitythread.java:141) 05-13 05:55:33.031: e/androidruntime(1022): @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 05-13 05:55:33.031: e/androidruntime(1022): @ android.os.handler.dispatchmessage(handler.java:99) 05-13 05:55:3

Assign Jquery array to php session array? -

i have little confusion while assigning jquery array php array, have multiple checkboxes on page, want assign value on click event, retrieve values perfectly, fails assign php array, here code during testing, want assign php session after working: function updatesession() { var allvals = []; <?php $ids = array()?> $('#c_b :checked').each(function() { allvals.push($(this).val()); <?php $ids ?> = allvals; }); // testing here in alert! alert(<?=$ids?>); } $(function() { $('#c_b input').click(updatesession); updatesession(); }); }; many thanx in advance! you can't this. php executes on server before java script runs. can use php build dynamic javascript, can't update php variables javascript directly... pass values javascript server can via ajax or query string

android layout - i want to implement searchbar concept in my app -

i want implement searcb bar concept in app . when ever user clicks on searbar keyboard buttons need display default searchable button in ..i followed few of links ...but unable searchable bar nor keyboard populated buttons ... please me in advance . this searchable.xml placed res/xml <searchable android:label="@string/app_label" android:hint="@string/search_hint" > </searchable> and manifest file <uses-sdk android:minsdkversion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".searchboxactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.search" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <meta

comparison - C# IComparable for X and Y co-ordinates -

suppose have list<point> stores list of x , y points, want these ordered. suppose not know domain of x , y values in advance, i'll use long large enough purposes. at given moment, list can have large or small amount of points, , these points sparsely distributed, need able efficiently retrieve , insert particular points if exist in list. in past, i've used icomparable<> , list.binarysearch() great success. unfortunately, need able insert , retrieve based on both x , y value. if know domain of x , y in advance, , domain small enough, can add numbers 1 number raised next power of domain of other. ensures no collisions , can efficiently retrieve/insert values. example, if x , y both between 0 , 9, can compare on 10 * x + y . because data types 64-bit integers, can't this. without restricting domain, there other way can achieve functionality? one method work compare on x.tostring("n19") + y.tostring("n19"), string comparison in

ios - How to create custom navigation bar programmatically? -

i'm developer in objective c , need with set custom navigation bar on navigation controller programmatically don't use story board or xib. you can use this, if targeting ios 5 , above [mynavigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"customnavbar.png"] forbarmetrics:uibarmetricsdefault]; or [[mynavigationcontroller.navigationbar appearance] setbackgroundimage:navbackground forbarmetrics:uibarmetricsdefault]; you may need add custom navbar buttons. also have @ answers here.

mysql - Display Data from two Tables - Select two Tables at a time from a Database -

how select 2 different tables @ time ? 1st table (table name "table1") capacity comment 1.0 low 1.7 low 7.2 average 9.9 fine 10.0 great 2nd table (table name "table2") c1 c2 c3 c4 1.0 cc dd 1.7 ad ac pd 10.0 aw ad if input 1.0 should show capacity comment c2 c3 c4 1.0 low cc pd update select a.capacity,a.comment, b.c1,b.c2,b.c3 table1 inner join table2 b on a.capacity=b.capacity a.capacity= $name $rs = mysql_query( $sql ) or die('database error: ' . mysql_error()); $num = mysql_num_rows( $rs ); if($num >= 1 ){ echo ""; while($row = mysql_fetch_array( $rs )){ echo "<table> <tr> <th align='left' valign='middle'>capacity</th> <td align='left' valign='middle'>$row[capacity]</td> </tr

how to post message on wall on LinkedIn in android -

i'm using selvin's code in apps..but not getting how post message on wall.. here code.. have refer link integration here posting linkedin message android application package pl.osadkowski.litest; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.net.uri; import android.os.bundle; import android.widget.textview; import android.widget.toast; import com.google.code.linkedinapi.client.linkedinapiclient; import com.google.code.linkedinapi.client.linkedinapiclientexception; import com.google.code.linkedinapi.client.linkedinapiclientfactory; import com.google.code.linkedinapi.client.oauth.linkedinaccesstoken; import com.google.code.linkedinapi.client.oauth.linkedinoauthservice; import com.google.code.linkedinapi.client.oauth.linkedinoauthservicefactory; import com.google.code.linkedinapi.client.oauth.linkedinrequesttoken; import com.google.code.linkedinapi.schema.person; public class litestactivity extends

Bundle iOS settings app screenshots -

an app work correctly if user setup app's notification settings correctly in ios settings. ok bundle screenshots app itself, screenshots depict related screens of iphone/etc ios setup? ...or apple reject if screenshots of ios settings app not allowed in apps? i don't find saying problem @ https://developer.apple.com/appstore/resources/approval/guidelines.html something guts tells me disallowed. according app store review guidelines 10.2 apps similar apps bundled on iphone, including app store, itunes store, , ibookstore, rejected. i guess you're worrying apple think screenshots of ios settings app makes app similar bundled settings app? in opinion, if wrap screenshots nicely (e.g. frame, shadows etc) users know it's screenshot, there's no problem it.

javascript - jQuery Mobile How to prevent a page from going to the default state when refresh? -

i'm using jquery mobile ( no php or xml or else ) web application running on cherrypy , find out how can keep page has been set user after refreshing. as example of page, see fiddle: http://jsfiddle.net/xakxm/5/ in example, user may input text in response number , description . when user click submit,user see #configtable div . if page refreshed, user not go initial page ( #labels div' )but remain in the #configtable` (the 1 user can't input can click activate button") may there button clear states , page go default when refresh? is possible done? if refresh dom using window.open('index.html'); should clear in page

javascript - To Access Notepad, calculator through asp.net -

i m trying open notepad, calculator in button click in asp.net code behind c#. tried code system.diagnostics.process.start("c:\\windows\\system32\\notepad.exe"); this working fine in local system not working in server. tried javascript function executecommands(inputparms) { alert('ff'); var oshell = new activexobject("shell.application"); var commandtorun = "c:\\winnt\\notepad.exe"; if (inputparms != "") { var commandparms = document.form1.filename.value; } oshell.shellexecute(commandtorun, commandparms, "", "open", "1"); } even not working out. can please suggest me in on how open notepad application in client end out disturbing server notepad. this can't done. imagine security mess we'd in if web-page run arbitrary programs on client machine. oh wait... ;-)

elasticsearch - Stemming using Tire library -

i performing basic search functions using elasticsearch , tire basic configuration of snowball stemming analyzer has me stumped. i'm pretty following code example github page: https://github.com/karmi/tire here's ruby sample file (ruby 1.9.3, tire 1.8.25): require 'tire' tire.index 'videos' delete create :mappings => { :video => { :properties => { :code => { :type => 'string' }, :description => { :type => 'string', :analyzer => 'snowball' } } } } end videos = [ { :code => '1', :description => "some fight video" }, { :code => '2', :description => "a fighting video" } ] tire.index 'videos' import videos refresh end s = tire.search 'videos' query string 'description:fight' end end s.results.each |document| puts "* #{document.code} - #{docum

php - Using AND on same key in mongodb -

i have key in document structure follow: "tag": [ { "schemename": "http:\/\/somesite.com\/categoryscheme2", "name": "test tag2", "value": 1, "slug": "test_tag2" }, { "schemaname": "http:\/\/somesite.com\/categoryscheme3", "name": "test tag3", "value": 1, "slug": "test_tag3" } ] now, inputs tag=test_tag2andtest_tag3 . how can write query this? tried iterate through loop didnt got results. correct me if wrong don't need $and or $elemmatch , instead: $mongodb->collection->find(array('tags.slug'=>array( '$in' => array('test_tag2','test_tag3')))) should work, however, if english suggests second read does, can use $all in place of $in . ensure root documents must have slugs in them.

android - convert Uri to file path but can not open it in nexus 4 -

i open picture in album , uri. convert uri file path. in log shows mnt/storage/emulated/0/xxx.jpg. covert uri file path way like: cursor cursor = globalobjectmanager.getinstance().getcontext().getcontentresolver() .query(filepathuri, null, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); filename = cursor.getstring(column_index); the problem when open file function catches filenotfoundexception. string path = "mnt/storage/emulated/0/xxx.jpg"; fileinputstream in = new fileinputstream(path); the code works on other devices android 2.3-4.1. far know nexus 4 runs android 4.2 , mnt/storage/emulated/0/ works multi-user. in app must use fileinputstream() function read byte data of beginning of file. could tell me how fix bug? thanks! ok fix it. made big mistake! add mnt/ in front of storage/ needlessly, , takes bug. i believe seeing /storage/emulated/0 . we're seeing problem too,

oracle - Data dictionary report tool -

i asked extract oracle database dictionary tool. used power designer 12.5. they generate report , represents in html format. report includes tables , columns information’s, , programmers can ready it. bad thing it, needs week make such report (reverse engineering, customizing...). trying find fast tool can generate daily data dictionary tool. have found oracle data modeler , download see if fast tool. question: know fast tool generate data dictionary report ? oracle's sql developer tool produce html formatted data dictionary , easily, recall. data modeller functionality more complex need.

objective c - Reason for declaring a property as (strong, strong) -

i got large chunk of code else have written. first dismissed typo noticed in several other places well. the essentials other programmer (not sure of "skill level") declared properties as @property (strong, strong) nsobject *anobject; the compiler not complain wondering if there reason doing or should consider them "typos"? (the project uses arc) i see no sense in doing , surprised compiler not complain that.

vb.net - How to iterate through DevExpress items in RibbonPageGroup? -

i need iterate loop through items in ribbonpagegroup. try set visibility property ribbon items 'true/always' each rp ribbonpage in ribboncontrol.pages rp.visible = true each pg ribbonpagegroup in rp.groups pg.visible = true each btn devexpress.xtrabars.barbuttonitem in pg.?????? btn.visibility = devexpress.xtrabars.baritemvisibility.always next next next there no bar items within ribbonpagegroup. can iterate bar item links via ribbonpagegroup.itemlinks property. please refer accessing bar items , links article more information.

javascript - Inject code in inApp browser and get it's return value in the app -

i writing phonegap app, that's starting web app inside inappbrowser. feedback web app use further in phonegap app. so user starts web app, things there , upon clicking button, web app returns value phonegap app. i thought use executescript method of inappbrowser inject function, called inside web app using event, , when function called, evaluate return value inside web app. found not complete documentation of phonegap , question on stackoverflow: augmenting webapp native capabilities - bridging phonegap's inappbrowser rails web app application javascript sadly not work expected, because callback function fires imediately, without waiting injected function execute. here mobile app code <!doctype html> <html> <head> <title>inappbrowser.executescript example</title> <script type="text/javascript" charset="utf-8" src="cordova-2.7.0.js"></script> <script type="text/javascript

video - Identify Firewire device via DirectShow using EUI-64 -

i have 2 firewire video input devices ( canopus advc-300 ), want connect directshow filter chain. before constructing filter chain, i'd know camera (in case 1 left , ones right of scene captured). is there way read out eui-64 (an identifier, unique among firewire devices), know camera handling? edit: may not have been specific enough: may able eui-64 generally, think need via directshow input filter, know camera constructing filter chain with. i seem have found answer myself using graphstudio. "displayname" property unique among video input devices. found forum posts explaining how retrieve it .

kendo ui - changing Datasource of Kendoui Multiselect at runtime -

i bind data kendoui multiselect @ runtime. example suppose want bind cascade of drobdownlist. idea? <p> <label for="categories">catergories:</label> @(html.kendo().dropdownlist() .name("categories") .htmlattributes(new { style = "width:300px" }) .optionlabel("select category...") .datatextfield("categoryname") .datavaluefield("categoryid") .datasource(source => { source.read(read => { read.action("getcascadecategories", "coreparam"); }); }) .events(e =>e.select("select")) ) </p> <p> <label for="parameters">parameters:</label> @(html.kendo().multiselect() .name("parameters") .htmlattributes(new { style = "width:400px" }) .datatextfield(&q

Spring for Android. MediaType throws IllegalArgumentException: Invalid token character ';' in token "json;charset=utf-8" -

i'm trying use spring android jackson 2 create pojo rest call. // set accept header httpheaders requestheaders = new httpheaders(); requestheaders.setaccept(collections.singletonlist(new mediatype("application","vnd.livescore_app.api.v1+json"))); requestheaders.setcontenttype(new mediatype("application","json;charset=utf-8")); httpentity<?> requestentity = new httpentity<object>(requestheaders); // create new resttemplate instance resttemplate resttemplate = new resttemplate(); // add jackson message converter resttemplate.getmessageconverters().add( new mappingjackson2httpmessageconverter()); // make http request, marshaling response json array of events responseentity<appversionobject> responseentity = resttemplate.exchange("https://example.com", httpmethod.get, requestentity, appversionobject.class); appversionobject object = responseentity.getbody(); crashes following log trace 05-13 10:55:42.656:

mysql - Ruby/DataMapper: Problems with multiple many-to-many associations -

i have implemented models user-group relationship, 1 user can member , owner of 1 or more groups , 1 group can have 1 or more owners , 1 or more members. now, problem user.owned_groups returns 1 group if user owns more 1 group. i facing same issue user.member_groups , group.owners , group.members . methods returning 1 record. below models , values in database. models: - require 'rubygems' require 'data_mapper' require 'dm-types' module contacts class user include datamapper::resource property :id, serial, :key => true property :username, string, :required => true, :unique => true has n, :group_owners, :child_key => [:owned_group_id] has n, :owned_groups, 'group', :through => :group_owners has n, :group_members, :child_key => [:member_group_id] has n, :member_groups, 'group', :through => :group_members #------------------------------------------# # args s

How to transform LINQ filter expression to SQL Query? -

i'm wondering how can transform filterexpression in linq sql clause. {it => (iif((it.datasettitle == null), null, convert("ref".contains(it.datasettitle))) == convert(true))} are there convenient ways of changing above expression sql clause? generally speaking, wouldn't directly. underlying object implements iqueryable you're performing linq operation on handle work. since tagged odata, presume you're using wcf data services. in context object, can declare dbset typed properties. dbset implements iqueryable, , you.

java - cast List to ArrayList -

this question has answer here: casting arrays.aslist causing exception: java.util.arrays$arraylist cannot cast java.util.arraylist 7 answers when want cast arraylist object in list reference returned method: public static <t> list<t> aslist(t... a) { return new arraylist<>(a); } the return type method aslist list reference arraylist object, means can cast arraylist reference. such : string[] colors = { "black", "blue", "yellow" }; arraylist<string> links = (arraylist<string>) arrays.aslist(colors) ; but code made run-time error : exception in thread "main" java.lang.classcastexception: java.util.arrays$arraylist cannot cast java.util.arraylist why it's happened? your assumption can cast arraylist not valid. the arraylist concrete type implement list inte

variables - PHP: Unlink doesn't work in 'deeper' folder -

i tried deleting file folder not work... i tried changing ' " still not work... so tried putting exact value, , worked unlink('uploads/12/33.jpg'); this 1 deletes image gallery folder unlink('gallery/'.$id.'.'.$ext); unlink('gallery/thumbs/'.$id.'.'.$ext); this 1 doesn't work. unlink('uploads/'.$album_id.'/'.$image_id.'.'.$image_ext); unlink('uploads/thumbs/'.$album_id.'/'.$image_id.'.'.$image_ext); i tried changing dot comma , still didn't work :[ try echo " unlink('uploads/'.$album_id.'/'.$image_id.'.'.$image_ext); unlink('uploads/thumbs/'.$album_id.'/'.$image_id.'.'.$image_ext); "; and see if shows correct syntax. maybe you're still having incorrect value or missing slash or something. please paste results here if doesn't further.

java - Problems with GridBagLayout -

i cant transfer of relatet posts simple problem. in order gridbaglayout wrote simple example: jframe frame = new jframe(); jpanel main =new jpanel(); frame.setcontentpane(main); gridbaglayout gbl=new gridbaglayout(); gridbagconstraints gbc = new gridbagconstraints(); main.setlayout(gbl); jbutton btn1 = new jbutton("1"); jbutton btn2 = new jbutton("2"); gbc.gridx=0; gbc.gridy=0; gbc.gridheight=1; gbc.gridwidth=1; gbc.fill=gridbagconstraints.west; gbl.setconstraints(btn1, gbc); gbc.gridx=0; gbc.gridy=1; gbl.setconstraints(btn2, gbc); frame.setsize(new dimension(200,100)); main.add(btn1); main.add(btn2); frame.setvisible(true); here have problem neither .fill nor other parameter of gbconstrains sems work. ever 2 buttons in middle of window. thx in advance your configuration of gridbagconstraint incorrect: fill can take: none , vertical , horizontal or both . anchor can use

lucene - Solr 4 Spatial Search polygon vs polygon search with distance parameter -

is there way search polygon in x distance indexed polygons? i have indexed polygons , multipolygons in solr 4.2.1 index field type <fieldtype name="location_rpt" class="solr.spatialrecursiveprefixtreefieldtype" spatialcontextfactory="com.spatial4j.core.context.jts.jtsspatialcontextfactory" disterrpct="0.001" maxdisterr="0.000009" units="degrees" /> and can simple intersects queries fq=geo_location:"intersects(polygon((-0.141964 51.515580, -0.130119 51.516648, -0.129261 51.515900)))" so need: search polygon+distance in index full of polygons , search point+distance(a circle) in index full of polygons point + distance (a circle) supported: http://wiki.apache.org/solr/solradaptersforlucenespatial4 ex: geo_location:"intersects(circle(4.56,1.23 d=0.0710))" polygon + distance buffering polygon said distance , doing standard inte

jQuery Slide effect slides div separately -

i trying make simple slide effect not working way want, please me out. if can point me in right direction appreciate it. what want have div slide 1 div not 2 div. when click on button div slides down/up before arrow head, both arrow head , div slide up/down. when user clicks on button other open div slides before clicked button div slides down. here example of work. demo: http://jsfiddle.net/dscxj/ <div id="main_content"> <ul class="categories_list"> <li class="animated"> <a href="#propsal_templates" class="main_buttons"> <span class="category_list_titles"> <table width="150" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="150" alig

java - Converting JSON to String in Android with MySql project -

i'm new on android , i'm trying connect android application local server phpmyadmin. i've seen tutorial interaction android-mysql through php pages (using json), have problem output (how convert obtained json string, example?). make better understand problem, code: jsonparser.java public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } // function json url // making http post or method public jsonobject makehttprequest(string url, string method, list<namevaluepair> params) { // making http request try { // check request method if(method == "post"){ // request method post // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httppost.setentity(new urlencodedformentity(params)); htt