Posts

Showing posts from April, 2012

ios - Facebook login for Swift project -

i prompting users sign in through facebook obtain profile picture app's profile. code have requesting facebook sign in: func facebooksignin() { //current user that's logged in sign view let curruser = pfuser.currentuser() //create facebook session fbsession.openactivesessionwithreadpermissions(permission, allowloginui: true, completionhandler: { (session, status, error) -> void in fbrequestconnection.startformewithcompletionhandler {(connection, result, error) -> void in if error == nil { if result != nil && result.objectid != nil { //create column in parse called "facebookid" curruser!.setobject(result.objectid string, forkey: "facebookid") curruser!.saveinbackground() } } } } it worked fine before turned app development mode public. now, every time click "sign in on facebook&

vb.net - how to count the rows with blank cells in datagridview -

i'm user of vb.net 2008 , developing system our department. need regarding count rows have empty cells in datagridview. count of rows must displayed in label. here's code. for = 0 dgvmonitoringboard.rows.count - 1 if dgvmonitoringboard.rows(i).cells(24).value.tostring = " " x += 1 end if next lblfortransfer.text = "items transfer purchasing:" & x a little different approach @equisde. use linq case. return count of how many rows either have dbnull.value or empty string... here's 1 liner... dim count integer = datagridview1.rows.cast(of datagridviewrow).where(function(r) r.cells.cast(of datagridviewcell).tolist.any(function(c) c.value dbnull.value orelse string.isnullorempty(cstr(c.value).trim))).count here's top down - sometime's easier read... dim count integer = datagridview1.rows.cast(of datagridviewrow) _ .where(function(r) r.cells.cast(of datagridviewcell).tolist _

r - Sampling from high dimensional sphere with noise -

i want generate sample of vectors high dimensional sphere noise. i.e. i'm trying create sample such vector x in r^n , holds ||x+epsilon||^2 = 1 epsilon iid vector in r^n of component epsilon_j distributed n(0,sigma^2). does have idea how implement it? i'd prefer use r. thank you! i think should work. turned function. d = 5 # number of dimensions n_draws = 100 # number of draws sigma = 0.2 # standard deviation i begin sampling random vectors should uniformly distributed on unit sphere. normalizing draws d-dimensional multivariate normal distribution. (there's more direct way step, i'll using rmvnorm again later convenient.) call them dirs because, since we're normalizing, we're doing in step sampling "directions". library(mvtnorm) # sample dirs = rmvnorm(n = n_draws, mean = rep(0, d)) # normalize dirs = dirs / sqrt(rowsums(dirs^2)) now draw multivariate normal add noise. x = dirs + rmvnorm(n = n_draws, mean = rep

python - django celery and rabbitmq access refused error -

i have installed rabbitmq server , followed these steps: sudo touch ~/.procfile sudo vi ~/.procfile and added export path=$path:/usr/local/sbin after added user , permission sudo rabbitmq-server -detached sudo rabbitmqctl add_user myuser mypassword sudo rabbitmqctl add_vhost myvhost sudo rabbitmqctl set_permissions -p myvhost myuser “.*” “.*” “.*” and in settings file did : broker_url = “amqp://myuser:mypassword@localhost:5672/myvhost” it working fine in local. trying send multiple emails @ once. to start celery using supervisor in production. sudo aptitude install supervisor in production have created my-project.config inside /etc/supervisor/conf.d/my-project.conf my config file looks like: [program:celery] command=/var/www/html/myproject/venv/bin/python /var/www/html/myproject/manage.py celeryd --loglevel=info environment=pythonpath=/var/www/html/myproject directory=/var/www/html/myproject user=www-data numprocs=1 stdout_logfile=/var/log/celeryd.log std

JavaScript in iOS that responses to programmatic calls -

i'm using processing hype framework create visualizations , want put in ios app. i've searched around bit , looks easiest solution export processing js , put in uiwebview . the part i'm unsure need able send input js adjust visualization on steady timer. first thought can set key listeners in js, , programmatically simulate key press within app. possible? there other solutions? not javascript expert know can run js in uiwebview. eg: // nsstring *innerhtml = [self.mywebview stringbyevaluatingjavascriptfromstring:@"document.documentelement.innerhtml"]; // set [self.mywebview stringbyevaluatingjavascriptfromstring:@"document.documentelement.innerhtml"]; i hope guides in right direction. source

model view controller - populating drop down box in mvc with list -

here controller code public actionresult index() { list<dropdown> lobj = new list<dropdown>(); //datalayer.dboperation dob = new datalayer.dboperation(); data.db odb = new data.db(); dataset ds = new dataset(); ds = odb.loadgrid(); foreach (datarow dr in ds.tables[0].rows)//adding data list data set { lobj.add(new dropdown { data = dr["city"].tostring() }); viewbag.city = new selectlist(lobj); } return view(); } and view page code @html.dropdownlist("city") its shows 6 times "mvc.models.dropdownlist" names in dropdown not show city names pls me in advance it's because creating anonymous type not read view. try this: lobj.add(new selectlistitem { value = dr["city"].tostring(),

php - How to regenerate APP_KEY and set new passwords in Laravel 5 -

today restore macbook os yosemite , forgot backup .env file, lost app_key . now paswords not work anymore , understand that. that: php artisan key:generate then update passwords using code: route::get('/', function () { $users = new project\db\user; $users->update(['password' => hash::make('newpasswordhere')]); }); but when try update user using system , change password, can't login. that's code of update($id) method: $user = user::getbyid($id); $user->role_id = $request->get('role_id'); $user->first_name = $request->get('first_name'); $user->last_name = $request->get('last_name'); $user->email = $request->get('email'); if ($request->has('password')) { $user->password = hash::make($request->get('password')); } $user->active = $request->get('active'); $user->update(); what doing wrong? my setup macbook pro - yos

javascript - Toggle & Set Cookie -

i have trouble understand jquery. hoping me setting cookie toggle. my script works following way, user toggle(); , changes class in-turn changes bootsrap grid layout 4 columns (3) 6 columns (2), part works fine, wanted add cookie sets according user preference of chosen columns. below js code this: // toggle click // $(".two, .three").click(function() { $(".two, .three").toggle(); }); // switch class , grid // $('.grid-toggle a').click(function(event) { $('.list-products li').removeclass('col-xs-3 col-sm-3 col-xs-2 col-sm-2 col-xs-3 col-sm-3 col-xs-4 col-sm-4 col-xs-6 col-sm-6'); if ($(this).hasclass('three')) { $('.list-products li').addclass('col-xs-4 col-sm-4'); } if ($(this).hasclass('two')) { //for less products $('.list-products li').addclass('col-xs-6 col-sm-6'); } return false; }); after lot of research using

postgresql - Optimising Hash And Hash Joins in SQL Query -

i have bunch of tables in postgresql , run query follows: select distinct on ...some stuff... "rent_flats" inner join "rent_flats_linked_users" on "rent_flats_linked_users"."rent_flat_id" = "rent_flats"."id" inner join "users" on "users"."id" = "rent_flats_linked_users"."user_id" inner join "owners" on "owners"."id" = "users"."profile_id" , "users"."profile_type" = 'owner' inner join "phone_numbers" on "phone_numbers"."person_id" = "owners"."id" , "phone_numbers"."person_type" = 'owner' inner join "phone_number_categories" on "phone_number_categories"."id" = "phone_numbers"."phone_number_category_id" inner join "localities" on "lo

ajax - Grails interpreting posted JSON data incorrectly by adding brackets [] to the keys of the object -

i posting data server client side using ajax call. data sent server in form of javascript object, formed this: var dataobj = { data: rolelist, count: count, units: unitlist } and posted server via jquery ajax call. the problem when data received on server, grails adding square brackets keys in data values. example, when print out "params" on server, looks this: [data[]:[data1, data2, data3], count: 3, units[]:[unit1,unit2]] whereas should like: [data:[data1,data2,data3]....] the problem have these square brackets when try use command object validation of data, data binding cannot take place variable names within command object not include square brackets (and of course can't create variable name in grails include these brackets) does know why these brackets being added keys in object (when value array , not key itself) , can circumvent problem? this behaviour doesn't come grails, jquery, see section serializatio

logstash grok filter for custom logs -

i have 2 related questions. first how best grok logs have "messy" spacing , on, , second, i'll ask separately, how deal logs have arbitrary attribute-value pairs. (see: logstash grok filter logs arbitrary attribute-value pairs ) so first question, have log line looks this: 14:46:16.603 [http-nio-8080-exec-4] info metering - msg=93e6dd5e-c009-46b3-b9eb-f753ee3b889a create_job job=a820018e-7ad7-481a-97b0-bd705c3280ad data=71b1652e-16c8-4b33-9a57-f5fcb3d5de92 using http://grokdebug.herokuapp.com/ able come following grok pattern works line: %{time:timestamp} %{notspace:http} %{word:loglevel}%{space}%{word:logtype} - msg=%{notspace:msg}%{space}%{word:action}%{space}job=%{notspace:job}%{space}data=%{notspace:data} with following config file: input { file { path => "/home/robyn/testlogs/trimmed_logs.txt" start_position => beginning sincedb_path => "/dev/null" # testing; allo

hardware - Process syncronization VHDL -

since in vhdl process collection of sequential statements , if write more 1 process these ones executed concurrently possible sync. them? as example architeture my_arch_is of my_entity begin proc_1 : process(...) begin -- code end process; proc_2 : process(...) begin -- code end process; proc_3 : process(...) begin -- code end process; end architecture; what achieve following, process 1 kind of selector (i.e. assigns bit under specific event) process 2 , 3 instead compute in parallel 2 possible result, compute selector , both results , using vhdl construct "if selector 0 take result of process 2, otherwise take result of process 3", multiplexer. is possible (if make sense of course)? yes, possible. , if use example, conditional statement selecting 1 of 2 results, given bit value provided process 1, synthesized multiplexer.

css - HTML: Bootstrap Navbar has full spanning underline that I can't identify? -

Image
i creating practice navbar using bootstrap cdn. cake except default there underline either wish remove or customize, didn't put there not sure how identify in css selectors. using chrome dev tools found item display: table when disable bar jumps above tabs. table relate behind tabs, not actual line itself. my html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>mockup navbar</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <style type="text/css&qu

python - Pygame Class returning TypeError with not enough positional arguments -

i'm starting learn pygame , draw rectangle i've made class. what's required __init__ part of rectangle class: def __init__(colour, x, y, width, height, thickness): that's 6 arguments. create rectangle this: goalrectangle = rectangle(red, 200, 60, 100, 100, 0) where red equal (255, 0, 0) above, purpose of convenience. however, when run program told __init__() takes 6 positional arguments 7 given - am passing 6 arguments. help? you forgot add self parameter in __init__ . try: def __init__(self, colour, x, y, width, height, thickness): here why need explicitly pass self argument in class constructors in python.

django - Pop up message when there are no records -

template {% item in category %} <tr> <td>{{ item.invoice_no }}</td> <td>{{item.invoice_date_of_issue}}</td> <td>{{ item.po_no }}</td> <td>{{ item.estimate_no}}</td> <td>{{ item.customer_id}}</td> <td>{{ item.subject_id}}</td> <td>{{ item.discount}}</td> <td>{{ item.status }}</td> <td><a name="del" href='/invoiceupdate/{{item.invoice_no}}/'>update</a></td> <td><a class="delete" data-confirm="are sure delete item?" href='/invoicedelete/{{item.invoice_no}}/'><img src="http://icons.iconseeker.com/png/fullsize/aspnet/trash-delete.png"></a></td> </tr> {% endfor %} view.py def invoice_date(request): id = invoice.objects.all().values_list('customer_id', flat=true)

"Adapter deployment failed: Could not resolve placeholder" error in IBM MobileFirst 6.3 -

i'm unable read property's value worklight.properties file. i added property publicprotocol=http in wroklight.properties file , used property in adapter.xml <protocol>${publicprotocol}</protocol> i'm getting following error: adapter deployment failed: not resolve placeholder 'publicprotocol' this works fine me using ibm mobilefirst platform studio 6.3.0.00-20150214-1702 created new project http adapter. added server\conf\worklight.properties following: mycustomproperty=http server automatically restarted changed adapters\myadapter\myadapter.xml follows , re-deployed adapter: - <protocol>http</protocol> + <protocol>${mycustomproperty}</protocol> to verify worked simply: right-click myadapter folder , selected run > invoke mobilefirst procedure , click on ok invoke default procedure. a browser window opened successful invocation.

java - Createwindowex invalid handle error -

i using jna functions call winapi public mufunction(){ magnification.instance.maginitialize(); rect desktoprect= new rect(); hwnd desktop = user32.instance.getdesktopwindow(); user32extra.instance.getwindowrect(desktop, desktoprect); hinstance hinstance =kernel32.instance.getmodulehandle(null); hwnd lsm = user32extra.instance.findwindow(null, "mywindow"); hwnd hwndmag = user32extra.instance.createwindowex(new dword(0x00000000l), "magnifier", "magnifierwindow", new dword(0x40000000l|0x0001l|0x10000000l), desktoprect.left, desktoprect.top, desktoprect.right-desktoprect.left, desktoprect.bottom-desktoprect.top, desktop, null, hinstance, null); system.out.println(native.getlasterror()); // return 6 error } magnification api code public interface magnification extends stdcalllibrary { magnification instance = (magnification) native.loadlibrary("magnification", magnification.class,

php - nginx docker instance multiple application -

so, dockerizing architecture consists of multiple php applications ran on apache. if i'm right need: 1 nginx container , 1 php container , multiple data-containers volume-from in nginx container. how able have multiple data container linked nginx container? example got app1.domain.com volumed /data/app1 , app2.domain.com volumed /data/app2 etc etc. you can create 1 volume container each app: app1: docker create -v /data/app1 --name app1 .... app2: docker create -v /data/app2 --name app2 .... then link them nginx container with: docker run --volumes-from app1 --volumes-from app2 --name nginx ... nginx ... more information volumes can find in official volumes documentation .

ubuntu - Disable support for Random Address for LE Advertising in Bluez 5.31 -

i using bt/le dual mode dongle run in le mode custom manufacture data (to act oob medium). functionality works in ubuntu desktop system (kernel - 3.13.0-57-generic) fails in raspbian (kernel - 4.0.9+). guess has kernel implementation of hci not sure. in ubuntu, running dual mode dongle in le mode can see mac address using hcitool (lescan). if run in raspbian can see random address advertising rather public address advertising. also using static-addr command btmgmt not working. (still getting random address). so, how disable random address or how can use public address instead of random address? thanks in advance. it seems triggered activated privacy feature . see section 10.7.1 privacy feature in peripheral of core 4.0 specification . support of privacy feature in peripheral depends on presence , value of 2 characteristics: peripheral privacy flag characteristic defined in section 12.3 , reconnection address characteristic defined in sec- tion 12.4.

html - how can i get the selected value of dropdown list in php? -

i have seen several question can not find answer? add value dropdown through loop , want show value when select 1 value dropdown box .but can not find . $items[] = $file ; echo '<select name="value">'; foreach($items $video){ echo '<option value="' . $video . '">' . $video . '</option>' ; } echo '</select>'; $value = $_get['footage']; how can value when select value in dropdown box. you need add html selected attribute <select> $value = $_get['footage']; /* typo*/ $items[] = $file ; echo '<select name="value">'; foreach($items $video){ $selected = ($value == $video) ? 'selected="selected"' : ''; echo '<option value="' . $video . '"' . $selected . '>' . $video . '</option>' ; } echo'</select>';

amazon web services - aws - how to access opsWorks app with ELB? -

my app easy deployed on 3 instances using opsworks. can access using instance ip's fine. my question is: how can access using load balancer? elb says 3 instances inservice, typing public dns on browser, loads forever , shows nothing. testing elb public dns on http://whatsmydns.com shows ip's aren't instances. am doing wrong? i have added public dns app hostname. there couple things check: check load balancer listeners configured listen , pass traffic same port instance listening on (for example http traffic 80 => http 80, https traffic 443 => https 443) check security group of webservers allows traffic loadbalancer. though if can access instances directly via browser, i'm guessing open 0.0.0.0/0 shouldn't issue here? check security group of load balancer allows access public on needed ports (typically 80 , 443) check elb healthcheck not failing (under elb instances can see if instances in service or not) if says "out of servi

c# - How can you get the non-intersected portion of two lists of strings? -

i have 2 lists of strings, illustrated comma-separated below. how can inverse of intersection (i.e. items in 1 or other list not both? for example: string test1 = "word1,word2,word3,word4"; string test2 = "word2,word4"; in example, looking "word1" , "word3" since each occur in 1 list. public static void test() { string test1 = "word1,word2,word3,word4"; string test2 = "word2,word4"; list<string> test1list = test1.split(',').tolist(); list<string> test2lists = test2.split(',').tolist(); list<string> result = new list<string>(); foreach (var item in test1list) { if (!test2lists.contains(item)) { if (result.any()) { result.add("," +item ); } else { result.ad

Python: TypeError while searching in a string -

when run code: stdout = popen(callbackquery, shell=true, stdout=pipe).stdout output = stdout.read() if output.find("no records found matched search criteria") == -1: print(output) else: # nothing print("it's fine") i following error: if output.find("no records found matched search criteria") == -1: typeerror: 'str' not support buffer interface i understand character encoding don't know , how need convert this? for people wondering why issue occured. subprocess documentation - if universal_newlines true, file objects stdin, stdout , stderr opened text streams in universal newlines mode, described above in used arguments, otherwise opened binary streams. the default value universal_newlines false, means stdout binary stream, , data returns byte string. and issue occurs because trying .find() on byte string passing in string argument. simple example show - >&g

parse.com - Parse Batch Background Jobs to Bypass 15 Minute Limit -

i running scheduled background job each night pulls data every 1 of our users , updates element in user data table each user. has approximate time complexity of n n our total users. however, parse allows 15 minute functions maximum. i trying split our users 5000 user-batches. way, can run function on each batch sequentially. know how parse background jobs , cloud code?

java - scanner next() Inputmismatch exception ..used nextLine() after nextInt() -

this question has answer here: how compare strings in java? 23 answers i couldn't find bug. used nextline() after reading nextint() still next() not reading word("update"). missing? input read: 2 4 5 update 2 2 2 4 query 1 1 1 3 3 3 update 1 1 1 23 query 2 2 2 4 4 4 query 1 1 1 3 3 3 2 4 update 2 2 2 1 query 1 1 1 1 1 1 query 1 1 1 2 2 2 query 2 2 2 2 2 2 my code: scanner sc = new scanner(system.in); int t = sc.nextint(); for(int i=0 ; i<t ; i++){ int n = sc.nextint(); int m = sc.nextint(); sc. nextline (); system.out.println(n+ " " + m); for(int j=0 ; j<m ; j++){ string q = sc.next(); // tried (string)sc.next(); if(q == "update"){ int x =

R OR comparing two booleans, I want F | NA to return F -

i have situation have 2 vectors 1's, 0's , na's. want take highest non-na value @ each index. eg. take these 2 vectors v1 , v2: v1 = c(1,0,1,0,0,1,na,na,0,1) v2 = c(1,na,1,0,1,na,1,na,0,1) you convert them boolean , v1 | v2 there following problem: 1 | 0 = t 0 | 1 = t 1 | 1 = t 0 | 0 = f na | na = na <--- 1 | na = t <-- 0 | na = na <--- want return f there's solution using apply , max , problem max(c(na,na), na.rm=t) returns -inf . any way in 1 liner? since you're comparing 2 numeric vectors doesn't make sense me convert them logical vectors determine pairwise largest values. pmax returns element-wise maximum of vectors , comes na.rm option handle missing values: pmax(v1, v2, na.rm=true) # [1] 1 0 1 0 1 1 1 na 0 1

hangs when execute powershell script using php -

when tring run powershell script using $out = shell_exec('powershell.exe -command c:\xampp\htdocs\web\ping.ps1 < nul'); echo $out; it hangs , noting done , page keep loading , that's simple script ping 8.8.8.8 -t i used command in powershell in order allow executing scripts @ first , set-executionpolicy remotesigned -scope currentuser but nothing changes . need , how execute powershell scripts using php ? this happening because tag -t gives command prompt command continue pinging until it's interrupted. the constant loading php executing power shell script , waiting said script stop executing before continuing. because power shell script never stops until navigate away page. it'll load so interruptions php memory being maxed out , failing. or user navigates away page halts execution. please review http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sag_tcpip_pro_pingconnect.mspx?mfr=true i recommend

c# - How to read one txt file into several textboxes by a button(in different order)? -

Image
for example: if txt file's contents aaa|bbb|ccc. i'd use button distribute aaa textbox2, bbb textbox5, cccto textbox3 . how make it? have try lots of ways solve ,but still doesn't work.please~ if text file content this. aaaa|bbb|cccc dddd|eee|ffff then can try this. private void button1_click(object sender, eventargs e) { textbox1.multiline = true; textbox2.multiline = true; textbox3.multiline = true; stringbuilder sb1 = new stringbuilder(); stringbuilder sb2 = new stringbuilder(); stringbuilder sb3 = new stringbuilder(); var lines = file.readalllines("d:\\sample.txt"); foreach (var line in lines) { var splits = line.split("|".tochararray(), stringsplitoptions.removeemptyentries); if (splits.length > 2) { sb1.append(splits[0] + environment.newline); sb2.append(splits[1] + environment.newline);

apache pig - pig set data type of all columns -

im wondering if there way set data type of arbitrary number of items in tuple. example if create field using $(1..) , know items integers, can set that? like: .... generate (chararray)$0 (int..)($1..) i'm passing tuple udf , want save time in parsing , converting databytearray int.

html - Fixing an element on Y axis, but scrolling with page on x axis? -

this question has answer here: table header stay fixed @ top when user scrolls out of view jquery 17 answers is possible fix element 'y' position on page, when scrolling left , right, element scrolls on x-axis well? in case, have table of data has 20 columns in total (far many display without page scrolling). fix table headers top of page, fixes x-scrolling when scrolling left , right, headers not move. possible fix y-positioning of element? i've created basic fiddle showing standard table here: http://jsfiddle.net/0n9d92er/ . basically, want header 1-20 fixed @ top (for vertical scrolling), when scrolling right, should able see every header 1 20 (when horizontally scrolling). .header { width: 2000px; } .tg { border-collapse:collapse; border-spacing:0; } .tg td { font-family:arial, sans-serif; font-size:14px; p

html - Knockout - foreach databind in 2 column table layout -

i have following table i'm attempting loop through coverage lines. 2 columns different line in each, code duplicates same coverage in each column. suggesions on how 2 column layout without repetition? element should foreach binding go on? thanks. <table class="coverage-table" data-bind="foreach: $root.clientvm.customcoveragelines"> <tr> <td> <input type="checkbox" data-bind="checked: checked" /> <label> <span data-bind="text: $data.description"></span> </label> </td> <td> <input type="checkbox" data-bind="checked: checked" /> <label> <span data-bind="text: $data.description"></span>

css - HTML+JavaScript: How to highlight a row on click of a button in Javascript? -

i using below code generate dynamic table- <!doctype html> <html> <head> <script> document.write("<table id=apptable border=1 style=margin-top:10px; margin-left:10px;>"); document.write("<tr><th>select</th><th>name</th><th>location</th><th>action</th></tr>"); (row = 1; row < 5; row++) { document.write("<tr>"); (col = 1; col <= 4; col++) { if(col == 1) { document.write("<td><input type='checkbox' id='mapcheck' name='mytexteditbox' /></td>"); } if(col == 2) { document.write("<td width='140'>name</td>"); } if(col == 3) { document.write("<td width='200'>location<

sybase - how to select max top 10 (n) rows with there size? -

i have below query gets size of tables. intersted top 10 max size table there size. how ? select convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages, data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs sysobjects o type = 'u' order table_name searching similar: select top 10 max(datapages) sysobjects edit: also have size of indexes, adding sysindexes query enough or should add system table syscoments ? writing such way giving me top table name: select top 10 convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages, data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs sysobjects o type = 'u' order table_name , kbs this throwing error select top 10 data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs , convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages sysobjects o type

java - How to get data from Service in IntentService? -

in app have service (mainservice) runs in background , handles data images, messages, etc. i need show additional data (sender's avatar example) service in gcm notifications. i've implemented gcm this: gcmbroadcastreceiver.java: public class gcmbroadcastreceiver extends wakefulbroadcastreceiver{ @override public void onreceive(context context, intent intent){ componentname comp = new componentname(context.getpackagename(), gcmnotificationservice.class.getname()); startwakefulservice(context, (intent.setcomponent(comp))); setresultcode(activity.result_ok); } } gcmnotificationservice.java: public class gcmnotificationservice extends intentservice{ @override protected void onhandleintent(intent intent){ //need retreive data mainservice //tried bind mainservice here ... //send notification gcmbroadcastreceiver.completewakefulintent(intent); } } the problem can't bind mainse

java - Add line to XML using attribute as identifier -

my xml file looks like: <?xml version="1.0" encoding="utf-8"?> <test1> <task uuid="92f7f685-c370-4e55-9026-020e3cdcede0" status="1000"> <task_status>200</task_status> </task> <task uuid="92f7f685-c370-4e55-9026-020e3cdcede0" status=" <task_status>200</task_status> </task> </test1> this file stored in private app directory. want edit file , store in it's "newer" version in same directory. i have method write , read xml files: private void writetofile(string data, string filename) { try { string utf8 = "utf-8"; int buffer_size = 8192; fileoutputstream fileoutputstream = openfileoutput(filename, context.mode_private); bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(fileoutputstream, utf8), buffer_size); bufferedwriter.write(data); bufferedwriter.cl

How to get a Python datatype from a SQLAlchemy query? -

i have (sqlite3) database numeric(10, 2) field. want query , work standard python datatype (for me <class 'float'> ). in code below want list of floats - nothing more. how can without manual converting list? # python3 pseudocode class model(_base): __tablename__ = 'model' ... _weight = sa.column('weight', sa.numeric(10, 2)) ... query = session.query(model._weight) result = query.all() print(type(result)) print(type(result[0])) print(type(result[0][0])) this result can not work with <class 'list'> <class 'sqlalchemy.util._collections.result'> <class 'decimal.decimal'> when use numeric(10, 2, asdecimal=false) , int returned. know sqlite can not handle float numbers. btw. want work float numbers in matplotlib.

hadoop - how to run storm topology in my machine ...im having storm in my machine -

storm jar storm-starter-topologies-0.10.0-beta1.jar storm-starter-master.jar production-topology local i'm getting error: running: /usr/lib/jvm/java-8-openjdk-amd64/bin/java -client -ddaemon.name= -dstorm.options= -dstorm.home=/usr/local/hadoop/apache-storm-0.10.0-beta1 -dstorm.log.dir=/usr/local/hadoop/apache-storm-0.10.0-beta1/logs -djava.library.path=/usr/lib/jvm/java-7-openjdk-amd64 -dstorm.conf.file= -cp /usr/local/hadoop/apache-storm-0.10.0-beta1/lib/reflectasm-1.07-shaded.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/slf4j-api-1.7.7.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/clojure-1.6.0.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/log4j-api-2.1.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/core.incubator-0.1.0.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/hadoop-auth-2.4.0.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/kryo-2.21.jar:/usr/local/hadoop/apache-storm-0.10.0-beta1/lib/ns-tracker-0.2.2.jar:/usr/local/hadoop/apa