Posts

Showing posts from August, 2011

image processing - Invalid indexing operation error when trying to draw epipolar lines -

i'm creating stereo images processing project modeled on matlab's examples. copy pasted code 1 of them don't works well. i1 = rgb2gray(imread('viprectification_deskleft.png')); i2 = rgb2gray(imread('viprectification_deskright.png')); points1 = detectharrisfeatures(i1); points2 = detectharrisfeatures(i2); [features1, valid_points1] = extractfeatures(i1, points1); [features2, valid_points2] = extractfeatures(i2, points2); indexpairs = matchfeatures(features1, features2); matchedpoints1 = valid_points1(indexpairs(:, 1),:); matchedpoints2 = valid_points2(indexpairs(:, 2),:); figure; showmatchedfeatures(i1, i2, matchedpoints1, matchedpoints2); load stereopointpairs [flmeds, inliers] = estimatefundamentalmatrix(matchedpoints1,matchedpoints2,'numtrials',4000); figure; subplot(121); imshow(i1); title('inliers , epipolar lines in first image'); hold on; plot(matchedpoints1(inliers,1), matchedpoints1(inliers,2), 'go'); an error:

android - How can I know that the activity is return from system setting page? -

the main activity : public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.logo); tools.checknetword(logoactivity.this); } when activity starts ,it check out there's availabe network public static void checknetword(final context context) { if (!tools.isnetworkavailabe(context)) { new alertdialog.builder(context).seticon(r.drawable.hi).settitle(r.string.logo_dialog_title).setmessage(r.string.set_network) .setpositivebutton(r.string.ok, new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialoginterface, int i) { //跳转到设置界面 context.startactivity(new intent(settings.action_wireless_settings)); } }).setnegativebutton(r.string.cancel, new dialoginterface.onclicklistener()

Making Python display .txt files from directories -

print "which category view? savory, dessert, cake, soup or drink? " category = raw_input() if category == "savory": #opens directory according answer. os.listdir("savory") elif category == "drink": os.listdir("drink") elif category == "cake": os.listdir("cake") elif category == "dessert": os.listdir("dessert") elif category == "savory": os.listdir("savory") elif category == "drink": os.listdir("drink") elif category == "cake": os.listdir("cake") elif category == "dessert": os.listdir("dessert") i trying create code display recipes have been saved under directories. when run code nothing displayed if input recipes directories. firstly, you're not printing anything. e.g os.listdir("savory") should print(os.listdir("savory")) secondl

javascript - how to clear and add source data dynamically in jquery autocomplete -

this jquery code.year form input tag id.years array variable it's contain years values.i put array in autocomplete source.it's working fine.but once set autocomplete source equal null after set autocomplete source years array did not work.how solve problem? $("#year").blur(function() { var keyevent = $.event("keydown"); keyevent.keycode = $.ui.keycode.enter; $(this).trigger(keyevent); // stop event propagation if needed return false; }).autocomplete({ autofocus : true, source : years, selectfirst : true, select : function(event, ui) { variableyear = (ui.item.lable);

android - My app resets my integers when switching from horizontal to vertical -

this question has answer here: activity restart on rotation android 28 answers so first app on android , it's working great. however, when tilt screen horizontal view integers reset zero. if start horizontally switch vertical, resets integers 0 too. how can not reset , switch? override onsaveinstancestate(bundle outstate) method. put data in outstate bundle, , then, in oncreate(bundle savedinstancestate) , extract savedinstancestate . if data more complex trivial integer, , not implement parcelable interface, use fragment .

OpenGL 4.4 on Linux -

i want learn opengl development , running linux mint. khronos.org says following: the opengl 4.4 , opengl shading language 4.40 specifications released on july 22, 2013. as far understand mesa opengl implementation linux 1 version 3.1 believe. question is, can develop opengl 4.4 apps in linux environment or have use mesa's 3.1 version? you can develop opengl 4.4 software #including glext.h file http://www.opengl.org/registry/ you can run opengl 4.4 software using hardware drivers implement opengl 4.4 specification , gpu supports necessary hardware features. in practical terms, means need amd or nvidia gpu supports direct3d 11 , recent proprietary (closed-source) drivers gpu vendor. mesa3d open-source driver framework, partial support opengl 4.x. proprietary drivers amd , nvidia replace mesa3d own opengl implementation. note can develop opengl 4.4 software if system cannot run said software.

sorting - D3 sort() with CSV data -

i trying kinds of ways make .sort() work on csv dataset. no luck. for starts, i'd sort data "value" column. this function i'm running inside d3.csv api call , before select dom , append divs: dataset = dataset.sort(function (a,b) {return d3.ascending(a.value, b.value); }); before .sort , clean data: dataset.foreach(function(d) { d.funded_month = parsedate(d.funded_month); d.value = +d.value; }); }; everything seems in order. when console.log(d3.ascending(a.value, b.value)) , right outputs: -1 d32.html:138 1 d32.html:138 -1 d32.html:138 1 d32.html:138 etc.. yet bars data doesn't sort. what's wrong? it not clear provided code hazard guess not handling async nature of d3.csv. this plunkr shows sort code working fine . note data object declared, populated, , used. here partial listing. have added buttons re-order data . achieve need put ordering logic inside render rather inside d3.csv

ember.js - Trigger Ember Error Substate in Route Action -

let's have banananewroute that's responsible displaying new banana form , creating banana . app.banananewroute = ember.route.extend model: -> @store.createrecord('banana') actions: create: @currentmodel.save().then => @transitionto "banana", @currentmodel because input of application tightly controlled, it's safe assume if server returns type of error, it's application error , there's nothing user can it. i'd handle transitioning user separate error template whenever save action rejects. i took @ loading / error substates documentation, seems works model , beforemodel , aftermodel hooks. couldn't work create action. how can accomplish this? save returns promise. promise's takes both passing , failing function (pardon converted coffeescript). save().then ((results) -> console.log "it worked", results return ), (error) -> console.log "it failed", error ret

html - Activate scrollbar when element goes offscreen using jQuery? -

i using jquery slidetoggle hidden div when link clicked, div large , bottom half goes offscreen when appearing. cannot scrollbar activate user can scroll downward. here sample code: http://jsfiddle.net/3fgzu/ though works here, because of jsfiddle. on website, trying accomplish same thing like: $('#toggle3').click(function(){ $('#resume').slidetoggle(1000); $('html, body').animate({ scrolltop: $("#container").offset().top} + $('window').height() }, 2000); return false; }); i hope question makes sense. help! check link... might you.. #tabs { height:100%; overflow-y:auto; } from: how add scrollbar jquery tabs

ios - Make UIImageView Go Up Then Down Swift -

i need make uiimageview animate when screen tapped down when hits top. this code have got @ moment: override func touchesbegan(touches: nsset!, withevent event: uievent!) { if (cgrectintersectsrect(self.playerimagephone.frame, self.floorimagephone.frame)) { uiview.animatewithduration(0.4) { self.playerimagephone.center = cgpointmake(self.playerimagephone.center.x, self.playerimagephone.center.y - 50) println("player jumped") } } } override func touchesended(touches: nsset!, withevent event: uievent!) { uiview.animatewithduration(0.4) { self.playerimagephone.center = cgpointmake(self.playerimagephone.center.x, self.playerimagephone.center.y + 50) println("player jumped") } } this code working make go down problem allows user hold finger on screen , image stay up. how can make go down image finished going up? thanks touchesbegan can

Getting error after inserting 3 pages php data insert script -

i have 3 php pages details supposed inserted db in final php.. geetting these warnings below data inserted. know these warning can turned of error reporting doesnt me go that.. warning: copy(): first argument copy() function cannot directory in /home/opterfhb/public_html/quest4home.com/search/add_edit_property_finish.php on line 301 warning: unlink(tmp_imgs/tmp_1011/..): directory in /home/opterfhb/public_html/quest4home.com/search/add_edit_property_finish.php on line 302 warning: copy(): first argument copy() function cannot directory in /home/opterfhb/public_html/quest4home.com/search/add_edit_property_finish.php on line 301 warning: unlink(tmp_imgs/tmp_1011/.): directory in /home/opterfhb/public_html/quest4home.com/search/add_edit_property_finish.php on line 302 i think have defined wrong way.. seeking help.. i getting error on section: // moveing temp images property directory if ($handle = opendir('tmp_imgs/tmp_'.$property_id)) { while (false !== ($fil

database - How clustered and Non clustered index makes search faster? -

clustered indexes physically order data on disk. say have table employee , columd employee_id. store values 9, 6, 10, 4 under employee_id. clustered index on employee_id. values on disk stored in sorted fashion i.e 4, 6, 9, 10. if search on employee_id id 9, database can use search algorithm binary search or other quick spot record id 9. possible not fine record in 1 operation binary serach. is correct? non clustered index non-clustered index has duplicate of data indexed columns kept ordered pointers actual data rows (pointers clustered index if there one). if take same example above. in case database create separate object store data along memory location.something this 9 -- phyical location 6 -- phyical location 10 -- phyical location 4 -- phyical location so first need search 10 in newly created object , memory location. go orginal memory location. so how come makes search faster ? also per understanding, index should created on column involved under cl

inheritance - Class equivalence in java -

a small hiccup led me basic question. intend check class equivalence in following case (academic curiosity - please not direct me instanceof or isinstance ): public class staticchild extends staticparent{ .... public static void main(string[] args){ staticchild thisobj=new staticchild(); system.out.println(thisobj.getclass()==staticparent.class); } } this gives compilation error: error: incomparable types: class<cap#1> , class<staticparent> system.out.println(thisobj.getclass()==staticparent.class); cap#1 fresh type-variable: cap#1 extends staticchild capture of ? extends staticchild what mean? what difference between type , class(specifically context - type , class of staticchild)? how rid of compilation error? since thisobj declared of type staticchild , expression: thisobj.getclass() returns object of type class<? extends staticchild> . trying compare object of type class<staticpar

javascript - How to verify Google's auth gapi.auth.signIn response? -

i have database users , want let user connect website account google account. want able let user log in google account , maybe later able interact google+ account etc. user logged in on website , initiates process click on button following: // user initiates process $('#google-connect').on(function() { gapi.auth.signin({ 'callback': function(data) { if(data['status']['signed_in']) console.log("signed in", data, gapi.auth.gettoken()); // additional user's data gapi.client.load('oauth2', 'v2', function() { gapi.client.oauth2.userinfo.get().execute(function(resp) { console.log("oauth", resp); data.userid = resp.id; // tell server add google account user's account $.post('/add/google', data, function(data) { console.log(&qu

android - Expand TextView with wrap_content until the neighbor view reaches the end of the parent -

Image
i need achieve following layout: i have 2 textviews in relative layout: green 1 fixed text wrap_content , black 1 has dynamic text wrap_content . black text can change , become long. want black textview expand text until green view reaches end of parent. if happens, black textview should stop expanding , ellipsize end. how can achieve that? what tried: <relativelayout android:id="@+id/parent" android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:id="@+id/lefttextview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxlines="1" android:layout_alignparentleft="true" android:textsize="18sp" /> <textview android:id="@+id/righttextview" android:layout_width="wrap_content" android:layout_h

Perl, XML::Twig, how to reading field with the same tag -

i'm working on processing xml file receive partner. not have influence on changing makeup of xml file. extract of xml is: <?xml version="1.0" encoding="utf-8"?> <objects> <object> <id>vw-xjc9</id> <name>name</name> <type>house</type> <description> <![cdata[<p>some descrioption of house</p>]]> </description> <localcosts> <localcost> <type>mandatory</type> <name>what kind of cost</name> <description> <![cdata[some text again, different first tag]]> </description> </localcost> </localcosts> </object> </objects> the reason use twig xml 11gb big, 100000 different objects) . problem when reach localcosts part, 3 fields (type, name , description) skipped, because these names used before. the code use go through xml

php - Separating mysql fetch array results -

i have mysql table contains index id, data entry , 10 other columns called peso1, peso2, peso3...peso10. im trying last 7 peso1 values specific id. like: $sql = mysql_query("select * table id='$id_a' order data desc limit 0, 7"); when try fetch values mysql_fetch_array, values together. example: while($line = mysql_fetch_array($sql)) { echo $line['peso1']; } i peso1 values 7 days together. how can separated? they appear because not separating them loop through them. for example, insert line break , see them on separate lines while($line = mysql_fetch_array($sql)) { echo $line['peso1'] ."<br />"; } you key array so $myarray = array(); $i = 1; while($line = mysql_fetch_array($sql)) { $myarray['day'.$i] = $line['peso1']; $i++; } example use $myarray['day1'] // returns day 1 value $myarray['day2'] // returns day 2 value

java - Check for running MIJ instances -

in matlab using mij interact imagej. there way (matlab command) check if instance of imagej been created via mij.start(...) command? thank you. looking @ mij source code : should able test if mij.imagej null. if so, imagej has not been started yet via mij.

android - FileProvider - name must not be empty -

i have following fileprovider in manifest : <provider android:name="android.support.v4.content.fileprovider" android:authorities="com.android.provider.datasharing-1" android:exported="false" android:granturipermissions="true"> <meta-data android:name="android.support.file_provider_paths" android:resource="@xml/paths"/> </provider> i getting following exception on app launch : java.lang.runtimeexception: unable provider android.support.v4.content.fileprovider: java.lang.illegalargumentexception: name must not empty @ android.app.activitythread.installprovider(activitythread.java:4793) @ android.app.activitythread.installcontentproviders(activitythread.java:4385) @ android.app.activitythread.handlebindapplication(activitythread.java:4325) @ android.app.activitythread.access$1500(activitythread.ja

c# - async await usage with TcpClient -

i started using new c#5.0 "async" , "await" keywords. thought got twist realized 1 thing made me doubt. here's how asynchronously receiving data remote tcpclient. once accept connection call function : static async void readasync(tcpclient client) { networkstream ns = client.getstream(); memorystream ms = new memorystream(); byte[] buffer = new byte[1024]; while(client.connected) { int bytesread = await ns.readasync(buffer, 0, buffer.length); ms.write(buffer, 0, bytesread); if (!ns.dataavailable) { handlemessage(ms.toarray()); ms.seek(0, seekorigin.begin); } } } after data received, loop goes on , on without reading anything. tested console.writeline in loop. using correctly? feel should not using while loop... the tcpclient.connected value not updated immediately. according msdn: true if client socket connected remote resource of most recent operati

android - How to alter the active text field in AS3? -

i have 6 text fields on stage along keypad numbers 0-9. ultimately going android app. , want able select text field , press keypad buttons , have numbers appear in active text field. i've been trying google active field , similar searches , can't seem find reference. keep in mind i'm fumbling around in dark i've tried gather multiple tutorials. code complete garbage: package { public class main { import flash.display.movieclip; import flash.events.mouseevent; import fl.managers.focusmanager; var focus:focusmanager = new focusmanager(this); btn_1.addeventlistener(mouseevent.mouse_down, inputnumber); public function inputnumber(m:mouseevent){ focus.text = 1; } public function main() { // constructor code } } } current errors: c:\users\otaku\documents\lottocount\main.as, line 19, column 35 1118: implicit coercion of value static type flash.display:interactiveobject possibly unrelated type flash

javascript - Build element(s) if less than 9 exist -

Image
i'm building portfolio of site. want show off 3x3 grid of work. i'm trying write javascript code render gray blocks placeholders total of squares (including shots) always 9. the goal: my code: function inventblank() { // define variables var shot = document.getelementbyid('shot'), = document.getelementbyid('a'), div = document.createelement('div'); // insertafter function function insertafter(referencenode, newnode) { referencenode.parentnode.insertbefore(newnode, referencenode.nextsibling); } // if existing shots less 9... if (shot < 9) { // render gray boxes until 9 (var = 0; < 10; i++) { var div = document.createelement('div'); div.classname = "shot"; div.insertafter(a, div); // insert new element "div" after "a" } } } inventblank(); // call anonymous function i

c++ - Overwriting custom string failing when non-default ctor was explicitly called -

for exercise in accelerated c++ i'm implementing custom string class called str . worked fine when underlying storage container custom vector ( vec ) i've run weird situational problem don't understand. if create new str object explicitly calling constructor str newstr("some words"); , try overwrite using cin >> newstr; program crashes in end, giving sigabrt in debugger when reaches str destructor (which delete[] data; ). this doesn't happen if create new, empty str use cin fill str newstr; cin >> newstr; , or if use cin overwrite str made using str newstr = "some words"; , fails when attempt overwrite str made explicitly calling non-default constructor though type displays correctly before being overwritten. another weird thing in case works fine if don't create new str s between creating/displaying odd-behavior str , using cin change value. str = "here a"; str b("and here b"); cout <<

ruby - How to implement twitter streaming with green_shoes? -

i'm charmed green_shoes , want create twitter client it. achieved log in twitter , home_timeline. i try implement streaming funciton, following. require 'green_shoes' require 'twitter' consumer_key = 'hoge' consumer_secret = 'hoge' access_token = 'hoge' access_token_secret = 'hoge' client = twitter::rest::client.new |c| c.consumer_key = consumer_key c.consumer_secret = consumer_secret c.access_token = access_token c.access_token_secret = access_token_secret end stream = twitter::streaming::client.new |c| c.consumer_key = consumer_key c.consumer_secret = consumer_secret c.access_token = access_token c.access_token_secret = access_token_secret end shoes.app tweets = client.home_timeline stack tweets.each |t| para "#{t.user.name}: #{t.text}" end end stream.user |obj| case obj when twitter::tweet stack para "#{obj.u

mingw - Conversion specifier of long double in C -

the long double data type can have these conversion specifiers in c: %le,%le,%lf,%lg,%lg ( reference ). i wrote small program test : #include <stdio.h> int main(void) { long double d = 656546.67894l; printf("%.0le\n",d); printf("%.0le\n",d); printf("%.0lf\n",d); printf("%.0lg\n",d); printf("%.0lg\n",d); return 0; } output: -0 -4e-153 -0 -4e-153 -4e-153 but none giving desired output, 656547 (as may understand). reason? the compiler used gcc version 3.4.2 (mingw-special). from old mingw wiki : mingw uses microsoft c run-time libraries , implementation of printf not support 'long double' type. work-around, cast 'double' , pass printf instead. example: printf("value = %g\n", (double) my_long_double_value); note similar problem exists 'long long' type. use 'i64' (eye sixty-four) length modifier instead of gcc's

iphone - how to fast and safely create pattern database for 6 tiles for the 663 approach to solve 15 puzzle? -

i creating pattern databases 6-6-3 pattern database approach solve 15 puzzle, code working generate possible patterns 3 tiles taking time 6 tiles crashes in between after generating fewer node. code far below- -(void)createandinsertpatterns{ fifteenpuzzle *startingpuzzle=[[fifteenpuzzle alloc]init]; startingpuzzle.pattern=[self getpatternstring:startingpattern]; startingpuzzle.cost=0; [self enqueue:startingpuzzle]; //[self insertintodb:startingpuzzle.pattern:0]; fifteenpuzzle* currentpuzzle; while((currentpuzzle =[self dequeue])!=nil){ if(![self isalreadyadded:currentpuzzle.pattern]){ nsstring *patternstring=[nsstring stringwithstring:currentpuzzle.pattern]; nsinteger cost=currentpuzzle.cost; [self insertintodb:currentpuzzle.pattern:cost]; nsmutablearray *allpatterns = [self allneighborforpattern:[self getarrayfromstring:patternstring]]; (nsmutablearray *obj in allpatterns) { fifteenpuzzle *p=[[fifteenpuzzle alloc]init];

mysql - Getting percentages from sql query and grouping -

so i'm have database holds survey questions , wanting run special query don't know how it. things note: there can 2-6 answers per question depending on question. these tables i'm using , example data: table: answers_only table: questions_only ╔════════════════╦═══════════╗ ╔═════════════════╦════════════════════════════╗ ║ answer_id (pk) ║ answer ║ ║question_id (pk) ║ question ║ ╠════════════════╬═══════════╣ ╠═════════════════╬════════════════════════════╣ ║ 65114 ║ yes ║ ║ 123 ║ happy? ║ ║ 614 ║ no ║ ║ 1967 ║ think you're smart? ║ ║ 23 ║ ║ ╚═════════════════╩════════════════════════════╝ ╚════════════════╩═══════════╝ table: questions ╔════════════════╦══════════════════╦════════════════╦════════════════╗ ║ unique_id (pk) ║ question_id (fk) ║ answer_id (fk) ║ person_id (fk) ║ ╠════════════════╬══════════════════╬═════════

c# - Open File dialogue for Windows 8 Apps -

i making app in user required choose video computer; want implement using openfilediaglogue box c# windows apps not available windows 8 app. how can windows 8 app? kinda appreciated! rather open file dialog, might want take @ file picker control. see link example : http://code.msdn.microsoft.com/wpapps/file-picker-sample-9f294cba

javascript - getting currently logged in user from sharepoint hosted angular app -

i'm trying figure out how @ least logged in sharepoint user's id within sharepoint-hosted angular sharepoint app. i'm unable call libraries outside of angular , value , apply angular model. know how this? the _spcontextinfo null when using $windows service or when try using code and cannot figure out how call spservices like var thisusersvalues = $().spservices.spgetcurrentuser({ fieldnames: ["id", "name", "sip address"], debug: false }); https://spservices.codeplex.com/wikipage?title=$().spservices.spgetcurrentuser&referringtitle=documentation what need in angular call code work in regular javascript? getting sharepoint logged in user without libraries little tough. ideally, want use jquery , spservices.js , relatively straight forward. however, since don't want use 3rd party library, suggest calling 1 of sharepoints built in web services via javascript. sharepoint web services

youtube api - How to Get Channel id or url after Google Oauth PHP -

i trying code application system youtube login. have issue after required authorisation oauth 2.0 want choosen youtube channel id in string not can please me. $client = new google_client(); $client->setclientid($client_id); $client->setclientsecret($client_secret); $client->setredirecturi($redirect_uri); $client->setapplicationname("bytnetwork"); $client->setscopes(array('https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/yt-analytics.readonly' )); if (isset($_session['access_token']) && $_session['access_token']) { $client->setaccesstoken($_session['access_token']); } else { $authurl = $client->createauthurl(); } so after want string like $channelid = "xxxxx"; use in code below $data = file_get_contents('http://gdata.youtube.com/feeds/api/users/$channelid?alt=json'); $data = json_decode($data, true); $st

php - Algorithm to count most repeated element; -

i have tree of structure blook -> house -> room each room has data , specific status red , blue , green , empty . i have iterate through tree , and display common color on each level . is there algorithm similar binarymask assign numeric value each color, , store there "sum" single integer , @ time able extract common color sum? (if of colors have equal counts priority red > blue > green taken) use array that... this, $colors = array('red' => 0, 'blue' => 0, 'green' => 0, 'empty' => 0); //assign values $colors['red'] += 1; //get maximun array_keys($colors, max($colors))

Looping a result set for a condition in Java using Jackcess -

using jackcess 2.0.4 trying query table , rows matching particular condition. map<string, string> testdata = new hashtable<string, string>(); database db = databasebuilder.open(new file("db.mdb")); table table = db.gettable("db_data"); cursor cursor = cursorbuilder.createcursor(table); while (cursor.findnextrow(collections.singletonmap("case", case))) { row row = cursor.getcurrentrow(); testdata.put(row.get("key").tostring(), row.get("data").tostring()); } the value testdata null no rows returned. not sure missing here. i have tried below approach. it's still same. for (row row : cursor.newiterable().addmatchpattern("testcaseid", testcaseid)) { testdata.put(row.get("key").tostring(), row.get("data").tostring()); } check code make sure column names , types match in table. sample data in table named [db_data] ... rowid testcaseid key data ----- -----

python - Tkinter and Threading -

i kind of new python , wrote client server based program. client side using tkinter gui , when program enters function communicates server , runs whole program gui freezes. know why happens have no idea how fix in specific program.. from tkinter import * import re import os import socket import os.path import time maxsize=5000000000 # bigest file u can send class application(frame): gateway =socket.socket(socket.af_inet, socket.sock_stream) def __init__(self, master): frame.__init__(self, master) self.grid() self.creat_widgets() def creat_widgets(self): self.instruction1 = label(self,text = "enter ip address:") self.instruction1.grid(row = 0, column = 0, columnspan = 2, sticky = w) self.ipentry = entry(self) self.ipentry.grid(row = 0, column = 1, sticky = w + e) self.instruction2 = label(self, text = "enter port:") self.instruction2.grid(row = 1, column = 0, columnspan

c - Program to separate digits of a number using asterisk -

i building program ask user input 5 digit positive number. display each of digits separated asterisk. example, if user inputs 51408 , output 5*1*4*0*8 . but, can't seem logic of finding separate digits (of number). how should it? now, code: #include <stdio.h> int main() { int mnumber, num5, num4, num3, num2, num1; printf("input number:"); scanf ("%d", &mnumber); //these ones have trouble can't seem logic// num5 = (mnumber/10000) / 1; num4 = (mnumber/1000) / 1; num3 = (mnumber/100) / 1; num2 = (mnumber/10) / 1; num1 = (mnumber/1) / 1; printf("=%d", num5); printf("*%d", num4); printf("*%d", num3); printf("*%d", num2); printf("*%d", num1); return 0; } to solve problem using approach, have remove significant part of number, once have processed it. example: num5 = mnumber/10000; mnumber -= num5*10000; num4 = mnu

AES and RSA encryption in iOS and JAva -

has 1 got chance work on rsa , aes in java in ios. want pass public key java platform ios , vice versa. let me know if 1 has worked on , got solution. chilkat helpful library agree s costing around 180$. let me know useful links if find. regards, bhat i have used rncryptor before on iphone , have jncryptor java well. library has worked me.

coldfusion - How to Output results based on year from query? -

i have query: <cfquery name="pivotquery"> select employeedept,cse_name,year,january,february,march,april,may,june,july,august,september,october,november,december ( select month= datename(month,execoffice_date) , year =year(execoffice_date) , employeedept , count(*) 'totalstars' csereduxresponses execoffice_status = 1 group employeedept , month(execoffice_date) , year(execoffice_date) , datename(month,execoffice_date) ) r join csedept d on d.cse_dept = r.employeedept pivot ( sum(totalstars) [month] in ( [january],[february],[march],[april], [may],[june],[july],[august], [september],[october],[november],[december] ) ) pvt </cfquery> this gets me data want based on month , year. i'm outputing results in table: &

c# - Cannot deserialize the current JSON object, WHY? -

i'm trying use webapi list of employees data base, using code: code of client mvc application: string u = "http://localhost:1411/api/employeeapi"; uri uri = new uri(u); httpclient httpclient = new httpclient(); task<httpresponsemessage> response = httpclient.getasync(uri); task.waitall(response); httpresponsemessage resposta = response.result; var msg = resposta.content.readasstringasync().result; employee[] employees = jsonconvert.deserializeobject<employee[]>(msg); return view(employees); and code of webapi: public ienumerable<employee> getemployees() { return db.employees.asenumerable(); } but error keeps popping , can't understand why: cannot deserialize current json object (e.g. {"name":"value"}) type 'dataaccess.employee[]' because type requires json array (e.g. [1,2,3]) deserialize correctly. fix e

MoreLikeThis not returning 100% score rate in Lucene.Net when comparing the same document with each other -

i don't know if calling lucene.net correctly. i'm trying call morelikethis function compare document , i'm getting score of 0.3174651 think should getting score of 1.0. expecting wrong expect? this code: int docid = hits[i].doc; var query2 = mlt.like(docid); topscoredoccollector collector = topscoredoccollector.create(100, true); searcher.search(query2, collector); scoredoc[] hits2 = collector.topdocs().scoredocs; var result = new list<string>(); (int k = 0; k < hits2.length; k++) { docid = hits2[k].doc; float score = hits2[k].score; } am doing wrong please? the thing doing wrong thinking lucene scores percentages. aren't. document scores query used compare strength of matches within context of single query. quite effective @ sorting results, are not percent

delphi - Obtain data from available form to autocreated one -

i transfer data statusbar of form2 (which on list of available forms , used login purposes), statusbar on mainform (which autocreated one). if use : procedure tmainform.formshow(sender: tobject); begin advofficestatusbar1.panels[0].text := form2.advofficestatusbar1.panels[0].text; end; i access violation error. . why happening? how can on this? based on comment following occurring: the code using login form this: procedure login; begin tform2.create(nil) try application.mainform.hide; if showmodal = mrok application.mainform.show else application.terminate; free; end; end; what happening here there implicit variable tloginform. not same auto created variable form2: tform2; sits in tform2 unit. variable freed directly after form closes. to see mean. if delete variable called form2 application, part of code won't compile line in original post. what have if wanted sort of thing (i have changed name of tloginform form2).

r - bquote: How to include an expression saved as a string object? -

Image
my goal annotate plot slope of best-fit line , label units of slope, label saved separate string object. i'm having trouble figuring out how bquote() convert string object expression, , combine other evaluated statements. a demonstration: # example data: x <- c(1:20) # x units: time y <- x * rnorm(20, 10, 2) # y units: length per time unit.label <- "l%.%t^-2" # label slope of best fit line lm1 <- summary(lm(y ~ x)) plot(y ~ x) the problem occurs when try annotate plot. can bquote() display slope: text(median(x), min(y), bquote(slope: .(round(lm1$coefficients[2], 2))) ) i can bquote() show slope's units: plot(y ~ x) text(median(x), min(y), bquote(.(parse(text = unit.label))) ) but i'm unable combine label , slope single bquote() statement: plot(y ~ x) text(median(x), min(y), bquote(slope: .(round(lm1$coefficients[2], 2)) .(parse(text = unit.label))) ) # error: unexpected symbol in "text(media

Reading MS Excel file from SQL Server 2005 -

i need read microsoft excel 2003 file (.xls) query in sql server 2005, , insert of data tables. reading file , using data not problem in itself, found that, column, null value instead of value that's shown in excel file. more specific: column 1 character long, , can contain 1 digit 0-9, or letter 'k'. it's when column contains 'k' query gives me null value. assumption that, since first few rows contain numbers values of column, query assumes numbers, , when finds letter turns null. i tried changing format of cells in excel file text, , using cast , convert (not @ same time) on value try make varchar, nothing. that looks older ole db driver excel. not doesn't work--you can still "query" spreadsheet it. maybe try newer: select * openrowset('microsoft.ace.oledb.12.0', 'excel 12.0 xml;hdr=yes;database=c:\file.xls', 'select * [sheet1$]') you'll need updated odbc driver on sql se

java - How to get WI-FI signal strength in percantage from Scan Network? -

i need scan wifi networks. how can getrssi() of wifi scan network (not of connection wi-fi network) int level = wifimanager.calculatesignallevel(wifi.getconnectioninfo().getrssi(), results.get(i).level); int difference = level * 100 / results.get(i).level; ok try find signal strength wifimanager manager; manager = (wifimanager) getsystemservice(wifi_service); list<scanresult> results = manager.getscanresults(); int level = getpowerpercentage(results.get(0).level);//0 first scan result , on. method find signal stength public int getpowerpercentage(int power) { int = 0; int min_dbm = -100; if (power <= min_dbm) { = 0; } else { = 100 + power; } return i; } hope ll you.

javascript - HighChart flags Data load issues -

i working on drawing graphs our data. there no problem on drawing graph basically. problem flags information not loaded , located on graph lines. let me give issues on it. data cannot brought graph if has on 900 numbers of items. one data might have more 4000 items. instead using 1 big data, tried spilt 1 data small pieces of data. each piece of data has 800 items, , intended being loaded on graph sequentially. however, process not done well. sometime graph module cannot load every piece exactly. moreover, process take time using 1 data. i wonder whether appropriate way load flag data contains many items exits or not. $(function() { var report_data; $.ajax({ type: "post", url:"/apps.chart/chart.reportshort", data:"callback=?&report_type=co&business_code=005930", datatype:"json", success:function(report){ report_data = report; } }); $.getjson(&

Can't retrieve data using php -

i trying retrieve data leave_balance.php , pass employee.php , data null. here script leave_balance.php : if($lid=="1") $bal = $bal + $replacementleave; here script employee.php : $bal = $rowe[bal]; then call $bal on html page: <input type='text' value='$bal'> can help? thank you. you can't directly use $bal otehr file. instead can use session variables . this- employee.php: session_start(); $_session['bal']= $rowe[bal]; leave_balance.php: if($lid=="1") $_session['bal'] = $_session['bal'] + $replacementleave; also, cannot use php variable inside html directly. use php var inside html text- <input type='text' value="<?php echo $_session['bal']; ?>"> or, can echo html statement- echo "<input type='text' value='".$_session['bal']."'>";