Posts

Showing posts from April, 2011

opengl - Black screen in LWJGL -

i'm porting game of code obfuscated due porting c java. my problem users report black screen , no other problems (sound working fine e.g.), no errors showing problem. on pc runs fine, , makes hell of debugging. i wondering if can post (list of) reason(s) might occurring. i've read somewhere 1 of issues using 32 bits java on 64 bits system. my code below, opensourced at: https://code.google.com/p/jake2t/ private void rendersidebyside() { glbindtexture(gl_texture_2d, 0); glbindframebufferext(gl_framebuffer_ext, sbsfboid); // render side side glpushattrib(gl_all_attrib_bits); glpushmatrix(); glmatrixmode(gl_projection); glloadidentity(); gluortho2d(0, width, 0, height); glmatrixmode (gl_modelview); glloadidentity (); glviewport(0,0,width,height); glclearcolor(0.0f, 0.0f, 1.0f, 0.0f); glclear (gl_color_buffer_bit | gl_depth_buffer_bit); gldisable(gl_

iphone - Release UIViewController give exception -

i have uiviewcontroller add uiviewcontroler this: reportviewcontroller *reportvc = [[reportviewcontroller alloc]initwithnibname:@"reportviewcontroller" bundle:nil]; [self.view addsubview:reportvc.view]; and try add [reportvc release]; after lines , exepction when try remove reportvc.view [self.view removefromsuperview]; did make error while release this? in code removing "self.view" superview, shouldn't. have remove "reportvc.view" superview. you can write this: [reportvc.view removefromsuperview]; [reportvc release]; reportvc = nil;

iphone - In iOS6, trouble forcing ViewController to certain interfaceOrientation when pushed on stack -

i have following view controller set up: viewcontroller1 able rotate freely orientation except portrait upside down. viewcontroller2 gets pushed on top of viewcontroller1, , i'd same orientation viewcontroller1 , i'd not able rotate. viewcontroller3 gets pushed on top of viewcontroller2. i'd viewcontroller3 in portrait mode. i'm having lot of issues trying accomplish in ios6 (haven't tried yet in ios5). first off, have created own navigation controller , put following in it: - (uiinterfaceorientation)preferredinterfaceorientationforpresentation { return [self.topviewcontroller preferredinterfaceorientationforpresentation]; } - (nsuinteger)supportedinterfaceorientations { return [self.topviewcontroller supportedinterfaceorientations]; } - (bool) shouldautorotate { return [self.topviewcontroller shouldautorotate]; } i've tried lot of different combinations of these things know avail. i'm struggling forcing vc3 presented portrait i

breeze - Adding a record into an association table using Breezejs -

background info so using breezejs , knockout ef5 , breeze mvc api controller on backend. 1 of tables in data base association table, 3 columns - id , 2 foreign keys(we'll call them fkey1 , fkey2 table1 , table2). in application, need add record association table. breeze knows relationships table has. situation breeze js makes new record me, find out records need associate it. need add in id of table1 entity fkey1 observable , table2 entity id fkey2 observable , add whole entities respective relationship properties , add push new entity object table1 , table2 entities association property? or adding id's new object automatically add objects relationship properties (maybe objects subscribed fkey1 , fkey2 properties? - i'm guessing happens in background of breeze, shot in dark though have no idea). creating new entities breeze super easy , love it, i'm little confused when comes creating new entities have lot of relationships. let me if need better descriptio

String Range forward and backward lookaround -

i trying write script gets input user , returns input in formatted area. have been using string range function cuts the input @ range give. there way around @ specified range find next space character , cut input @ location? for example, if have input of: lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris my current string range function formats input \r\n such: lorem ipsum dolor sit amet, consectetur dipisicing elit, sed eiusmod tempor in cididunt ut labore et dolore magna aliqua . ut enim ad minim veniam, quis nostrud e xercitation ullamco laboris as can see on line 1 adipisicing line 2 incididunt words have been cut off. looking way closest space location. line 1 have been before a on line 2 have been before i . …in cases may after word. is clear looking for? assistance great! the string range operation pretty st

java - Increasing the accuracy of proximity alerts in Android -

my application keeps track of user's location, , sets proximity alerts nearby stores returned api automatic-chickin type functionality. i'm hitting head against wall trying figure out how improve accuracy when proximity alert triggered network location. need way confirm user @ location either checking again within few minutes, or confirming current position via gps. part of issue context handling proximity alert intent service, works asynchronously causes issues when alerts fire in rapid succession. there's way (e.g. google+ checkin notifications), i'm @ loss next. my experience network location less accurate gps location, although neither 100% reliable. gps perfect, @ other times it's wrong maybe 50 metres or more. handle this, think best way combine 2 location sources using simple kalman filter, neither network or gps trigger promimity alerts directly, instead it's result of kalman filtering used. see answer smooth gps data full details of k

Django username already taken error -

i have form allows user create user account.the problem , whenever user submit username been taken through system . form doesn't raise error raise error when field missing. can kindly me def registration(request): form = userregistration() if request.method =='post': form = userregistration(request.post) if form.is_valid(): user = user.objects.create_user( username=form.cleaned_data['username'], email=form.cleaned_data['email'], password=form.cleaned_data['password'] ) user.is_active = true user.save() return render(request,'choose.html',{'form':form}) return render(request, 'register.html', {'form': form},) my forms.py class userregistration(forms.form): username = forms.charfield() email = forms.emailfield(error_messages={'required':'error miss

php - MySQL Join or Nest Loop -

i have table called workshops, , table called workshop_parts. each row in workshop_parts holds parent id references parent workshop, along various other data part. i trying figure out efficient way retrieve , display data on website. i want list workshop information , of parts below. with know right loop through workshops , have nested loop loops through parts. is there way might use join data in 1 fell swoop, or nested loop best solution? as per post actual join: sql left join vs multiple tables on line? select ws.name ws_name, part.name part_name, part.qty part_quantity workshop ws left join workshop_parts parts on (ws.id = parts.workshop_id); left join anywhere workshop id exists leave out parts have no matching workshop. inner join workshops , parts have match (workshops without parts not show, nor parts without workshops) right join workshop parts , other parts if have no workshop. edit here's best way i've found think it: http://www.cod

c# - Service Stack Serialization Exception for soap 1.1 -

the request message: <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <sendgetaccountnotification xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="mynamespace"> <getaccountresponse xmlns:d2p1="mynamespace"> <d2p1:account> <d2p1:busopsdesc>string</d2p1:busopsdesc> <d2p1:externalaccountid>string</d2p1:externalaccountid> </d2p1:account> <d2p1:externalaccountid>string</d2p1:externalaccountid> <d2p1:message>string</d2p1:message> </getaccountresponse> </sendgetaccountnotification> </soap:body> </soap:envelope> response message / error: <sendgetaccountnotificationresponse xmlns:i="http://www.w3.org/2001

mvvm - Child containers in MvvmCross IoC -

i have wpf mvvm application i'd refactor use mvvmcross support wpf , mono android implementations. currently using unity 3.0 dependency injection , rely on support container hierarchies (one main container w/ main view , view model , services; , each session server child container views, view models , services have limited lifetime). can ioc in mvvmcross support child containers? if not, how recommend implementing external ioc in manner compatible mvvmcross? update: don't need support multiple child containers-- single child container active @ 1 time. thanks! the mvvmcross framework stands today targeted @ 'mobile' , 'tablet' development. in area there aren't many situations i've encountered far need multiple containers - framework has adopted simple single container approach. if want/need multiple containers, mvvmcross designed can overridden if want to. if want override ioc library used, should able use pcl ioc container (or inj

c++ - Sharing class pointers between processes (UPDATED) -

i have server library client executable injects remote process. server's responsibility set sort of ipc/rpc implementation allow client seamlessly communicate remote process. update take @ following server-side header: #include <boost/interprocess/managed_shared_memory.hpp> #include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/containers/vector.hpp> #include <boost/interprocess/containers/string.hpp> #include <boost/interprocess/allocators/allocator.hpp> using namespace boost::interprocess; typedef allocator<int, managed_shared_memory::segment_manager> shmintallocator; typedef vector<int, shmintallocator> intvector; class { public: a(); a(string str, offset_ptr<intvector> ints) : m_str(string(str)), m_ints(ints) {}; ~a(); string m_str; offset_ptr<intvector> m_ints; }; class b { public: b(); b(offset_ptr<a> obj) : m_obj(obj); ~b(); void dosomet

command - Android JB 4.2.2 and Monkeyrunner script to make call -

i using jelly bean 4.2.2 on device , trying make call using monkeyrunner script. using below code working on ics in jb, doesn't type phone number in edit text box once key dialer screen opened.. experience issue? device.startactivity(component='com.android.contacts/com.android.contacts.activities.dialtactsactivity') device.type("8888888888") br srini the intent alternative correct 1 many cases, if want simulate real user dialing number can use culebra script edited autogenerated add dialnumber method , other minor things: #! /usr/local/bin/shebang monkeyrunner -plugin $avc_home/bin/androidviewclient-$avc_version.jar @! # -*- coding: utf-8 -*- ''' copyright (c) 2013 diego torres milano created on 2013-05-15 culebra v0.9.8 __ __ __ __ / \ / \ / \ / \ ____________________/ __\/ __\/ __\/ __\_____________________________ ___________________/ /__/ /__/ /__/ /______

css - What's the HTML to have a horizontal space between two objects? -

i have been searching answer , trying different things without success. kindly let me know how put spaces between 2 objects using php code? (please note: use wordpress, in case makes difference.) i know how vertically </br> , horizontal equivalent that? please note don't know whole lot code, detailed information able provide appreciated in advance - thank-you much! i guess want is: &nbsp; but not nice way align content. better put different content in <div> tags , use css proper alignment. you can check out post useful info: how insert spaces/tabs in text using html/css?

java - Cache a variable temporarily or for few minutes -

how cache variable temporarily or few minutes in java? i need use variable temporarily few minutes hitting database cause huge performance impact. the problem have db configuration value can changed user. such change needs captured without re-starting server. so finding option on how cache variable temporarily or few minutes in java. after 5 or 10 minutes interval can clear cache. something jcf. how linkedhashmap , customizing removeeldestentry . caveat being method invoked on puts.

iphone - How to find latitude longitude and timezone of any place? -

i working on iphone application in want find latitude, longitude , timezone details of place. how can these details @ time. we can find latitude , longitude how can exact time zone of place? could 1 please guide me ? thanks. it looks want this:- nsstring *timezonename = [[nstimezone localtimezone] name]; that returns "asia/kolkata" me. if using systemtimezone represents timezone used system (device) itself. localtimezone returns object represents current default time zone application. use api getting data , pass lat , long values. api getting timezone

failed installation - Saiku-Clicking on New query not displaying anything -

i downloaded saiku (saiku server 2.4 (including foodmart db)) following link - http://analytical-labs.com/downloads.php . following installation notes, have downloaded latest apache software, jdk. per instructions if go localhost 8080 see log on page. upon logging username , password admin , admin saiku main page. when click on 'new query' button nothing happening. not able see foodmart databse or dimensions or anything. can me have gone wrong? i have got working. problem after running start-saiku.bat file, command prompt file still running 'press enter continue..'. upon clicking this, cmd prompt ended , able browse through saiku localhost.

jquery - Ajax json respond not getting in success in POST method -

i not getting json response/success ajax while using jsonp datatype. getting blank response.is of gapi getting issue or other.i find similar problem not able json response this jquery code $.ajax({ url: 'includes/gapi.apis.php', data: {action: 'keyword'}, type: 'post', async:false, datatype: "jsonp", success: function(obj) { alert(obj); } php code $ga->requestreportdata(ga_profile_id,array('keyword'),array('visits','pageviews'),array('-visits'),$filter,$startdate, $enddate, $startindex, $maxresults); foreach($ga->getresults() $result) { //echo $result->getkeyword()."-------------------".$result->getvisits()."<br>"; $data[$i]['keyword']=$result->getkeyword(); $data[$i]['visits']=$result->getvisits(); $data[$i]['pages_visits']=round(($result

sqlite - No Such Column while compiling DELETE FROM table -

i getting error "no such column while compiling delete table". please help public string getdata() { string[] columns = new string []{key_rowid, key_header, key_quote_value}; cursor c = ourdatabase.query(database_table, columns, null, null, null, null, null); string result = ""; int irow = c.getcolumnindex(key_rowid); int iheader = c.getcolumnindex(key_header); int iquote_value = c.getcolumnindex(key_quote_value); (c.movetofirst(); !c.isafterlast(); c.movetonext()){ result = result + c.getstring(irow)+ "@" +c.getstring(iheader)+ ":" +c.getstring(iquote_value)+ ":"; } return result; } public void deleteentry(string deldata1) throws sqlexception { ourdatabase.delete(database_table, key_header + "=" + deldata1 , null); } } please me the deldata1 variable not initialized quoted string. print value of key_header , deldata1 in deleteentry function bef

jsp Ajax GET working POST not working -

i need refresh part of browser. hence using ajax. when use method, can see data @ server, when use post not able to. pointers please ? -----------code searchpan.jsp------------------------- <html> <% try { system.out.println("url " + request.getrequesturi()); system.out.println("pan " + request.getquerystring()); system.out.println("pan " + request.getparameter("pan")); } catch(exception e) { system.out.println("error happened " + e); } //promo_card cardobj = new promo_card(); //out.println(cardobj.getdata()); %> </html> ----------------------------code get------------------------------------ xmlhttp=new xmlhttprequest(); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate==0) document.getelementbyid('status').innerhtml='uninitialized'; else if(xmlhttp.readystate==1) document.getelemen

ios - UITableView datasource methods get called only once -

my cellforrowatindexpath doesn't updated after return detail view controller. homeviewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. self.title =@"welcome"; [eventstable registernib:[uinib nibwithnibname:@"eventcell" bundle:nil] forcellreuseidentifier:@"eventcell"]; //filtering process current date [self fetchusersfortype:1]; [eventstable reloaddata]; // configure bar button items.. uibarbuttonitem *filterbutton = [[uibarbuttonitem alloc]initwithtitle:@"filter" style:uibarbuttonitemstyleplain target:self action:@selector(filtertapped:)]; uibarbuttonitem *addbutton = [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(addtapped:)]; self.navigationitem.leftbarbuttonitem = filterbutton; self.navigationitem.rightbarbuttonitem = addbutton; refreshcontrol= [[uirefreshcontrol alloc]init]; [eventstable addsubview:refreshcontrol]; //

How to get current date time in milliseconds in android -

this question has answer here: get current time , date on android 31 answers i trying save file name current date , time in milliseconds. , while reading file want read latest one.here code calendar rightnow = calendar.getinstance(); long offset = rightnow.get(calendar.zone_offset) + rightnow.get(calendar.dst_offset); string sincemidnight = long.tostring((rightnow.gettimeinmillis() + offset) % (24 * 60 * 60 * 1000)); return sincemidnight+"_"+filename; i think can use this long time= system.currenttimemillis(); this return current time in milliseconds mode . surely work long time= system.currenttimemillis(); android.util.log.i("time class ", " time value in millisecinds "+time); here logcat using above function 05-13 14:38:03.149: info/time class(301): time value in millisecinds 1368436083157 if got dou

vb.net - VB two buttons with multiple clicks, sync issue -

i have 2 buttons refer same forms, 1 allows information pasted in directly other putting information manually. when forms completed put results text box. what happening if input method mixed, i,e pasted or manually inputted buttons become out of sync, button 1 may @ case 3 , button 2 case 5 may put results wrong box or replace existing result. based on code below there way reference state of each button, example if button 2 @ case 3 open form 5 (example). select case _step case 0 _step = 1 if string.isnullorempty(me.textbox6.text) popupform.show() else form3.show() end if exit select case 1 _step = 2 if string.isnullorempty(me.textbox7.text) form3.show() else loadform3.show() end if exit select case 2

python - PyDev change background colour of tooltips -

Image
i'm using pydev in eclipse (on ubuntu 12.04). default background colour tooltips black. given of text in tooltips (links function definitions) dark blue, can't read it. i've looked under preferences->editors->text editors , preferences->pydev->editor can't find appropriate setting. how can change this? thanks edit: this turns out ubuntu specific bug - exists in versions of ubuntu @ least 12.04. workaround linked in answer below. these setting default settings eclipse in windows (which use android development) i haven't faced such issue mentioned you,but yes had faced settings issue appcelerator titanium. and after applying eclipses setting titanium ide, problem resolved for editor **line number foreground** (r 120 g 120 b 120) (hue 0 sat 0 lum 120) **current line highlighting** (r 232 g 242 b 254) (hue 213 sat 22 lum 254) **print margin** (r 176 g 180 b 185) (hue 213 sat 12 lum 185) **find s

html - Remove applied CSS transformation -

i have applied -webkit-transform:rotatey(180deg); flip image. applying - webkit-transform:rotatey(0deg); rotate original position. have other classes applied, when check in chrome inspect element can see rotatey(0) still there should removed. how can remove animation element? .transition { -webkit-transform:rotatey(180deg); transform:rotatey(180deg); } .notransition { -webkit-transform:rotatey(0deg); transform:rotatey(0deg); } just this: .transition { -webkit-transform: rotatey(180deg); transform: rotatey(180deg); } .notransition { -webkit-transform: none; transform: none; } none seems default value

Facebook Open Graph issue while posting a message -

i have created story in app using action "check" , object "website". checked page in debugger tool , working fine. problem when trying post using open-graph api, throwing error "an active access token must used query information current user.". below code (php) post on facebook. please me in resolving issue. $access_token = $user->getaccesstoken(); $facebook->setaccesstoken($access_token); $publishstream = $facebook->api("/me/mylocalsite:interest?story= http://www.test.net/fbpost/test.html&message=test message", 'post'); i doing whole thing in testing enviourment. till app not approved. please suggest doing wrong.

osx - iPhone 5 Optimization Requirement -

i have submitted iphone app itune , got message "invalid binary". got mail apple following. dear developer, have discovered 1 or more issues recent delivery "xyz". process delivery, following issues must corrected: iphone 5 optimization requirement - binary not optimized iphone 5. of may 1, new iphone apps , app updates submitted must support 4-inch display on iphone 5. apps must include launch image of appropriate size. learn more iphone 5 support reviewing ios human interface guidelines. i have include launch image appropriate size got same asabove problem again , again . mac pc configure xcode: 4.0 mac os x: 10.6.8(snow leopard) iphone os: 4.3 resolve problem mandatory upgrade mac os x: if no please tell step resolve problem . facing problem @ 5-6 days before . please me . thank . yes have upload app iphone 5 , means have add 3 default screen application , , have upload app xcode 4.5 , , add armv7s since 1 may apple approve app work on i

use Google map with php and mysql to display locations -

i have map page include google map display users static locations using php , mysql because longitude , lattitude stored in database in village table village id in foreign key in user table used inner join problem browser not show can me ??? map.php <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print "$firstname $lastname"; ?></title> <link href='http://fonts.googleapis.com/css?family=oswald:400,300' rel='stylesheet' type='text/css' /> <link href='http://fonts.googleapis.com/css?family=abel|satisfy' rel='

Function on Javascript. Not work -

i have file .js 1 function. , starting class want call function. not know why, function returns nothing. code have follows: //valida data inserida pelo utilizador. function validardata(){ var datavalor = window.document.forms[0].data.value; if(datavalor == ''){ //verifica se o campo data está preenchido alert('o campo data encontra-se vazio. seleccione uma data!'); return false; }else{ var t = validar(datavalor); alert(t); return false; } } the code in file .js is: function validar(data){ return data; } does have idea why not work? without accompanying html go off of, answer shooting in dark.. but, provided attach function submit event, returning value of function... <form onsubmit="return validardata();"> <!-- ^ - in submit event(just listing way simple explanation instead of advanced event attaching) --> and provided functions defined in documen

How to convert json array of K/V to Java HashMap with Jackson JSON -

i learning first java json parser librairie witch jackson json. i'm trying convert java object list of id/note hashmap list. my json input this var basketlist = [ { "name": "basket 1", "productlist": { //id item incremente ordering "14":{ // quantity add id "quantity":6, "note": "thing" }, "15":{ "quantity":4, "note": "another thing" }, } }, { "name": "basket 2", "productlist": { "14":{ "quantity": 16, "note": "thing" }, "15":{ "quantity":2, "note": "another thing" }, "17":{ "quantity":7, "note&qu

c# 4.0 - how to get the auto generated values from sql using c#? -

i have stored procedure below.. create procedure [dbo].[spmyspdetails] @id varchar(6), @name varchar(50), @limit money, @status varchar(1), @accounts smallint begin if(len(isnull(@strdebtorid, '')) = 0) begin while 0 = 0 begin set @id = '9' + dbo.fngeneraterandomcode(5, '0123456789') if not exists (select 1 mytbl (nolock) s_id = @id) begin insert mytbl (d_id, d_name, d_limit, d_status, d_accounts, d_dtmstamp, d_balance) values (@id, @name, @limit, @status, @accounts, getdate(), @limit) break end i have c# sharp code call sp this... try { string id = ""; if (hddid.value.tostring() != "") { id = hddid.value.tostring();

.net - Remote check if machine is alive and reachable using c# under NAT -

i'm trying develop "backup service" should start if can't reach specific pc. the backup service should check if machine alive (ping isn't solution because remote machine can natted). maybe failed ssh connection can tell me if machine down\not reachable. the idea is: if (!endpointisalive){ //start backup }else{ //wait x , retry } nat no argument against ping stated in comment. in oppionion try re-invent wheel. advise check snmp protocol , snmp traps, fulfill needs. traps trigger based events sent management machine, alarm raised. you instantly know, if , machine went down.

portable class library - Get assembly version in PCL -

i have following line of code in .net 4.5 trying build portable class library. it's purpose assembly version: this.gettype().assembly.getname().version.major; the problem assembly.getname() not available in pcl. there way assembly version in pcl? i know possible parse assembly.fullname, want better solution. public static string version { { var assembly = typeof(mytype).gettypeinfo().assembly; // in pcl profiles above line is: var assembly = typeof(mytype).assembly; var assemblyname = new assemblyname(assembly.fullname); return assemblyname.version.major + "." + assemblyname.version.minor; } }

java - H2 jar compile to native windows code -

does has experience compiling h2 jar windows native code using e.g. excelsior jet. there chance work ? asking that, because considering convert whole java app native exe. thanks, lubos it should work, h2 doesn't make use of native code. however, perform reflection, degree of hand tweaking of excelsior required.

jsf 2 - Primefaces 3.3/3.4 tabview: ajax update on tabChange -

using following code, content of 2 tabs cleared on tabchange event instead of being updated: <h:form id="form"> <p:tabview id="tabview"> <p:ajax event="tabchange" listener="#{testbean.onchange}" update="@form"/> <p:tab title="tab 1"> <h:outputtext value="lorem ipsum dolor sit amet." id="ht1"/> </p:tab> <p:tab title="tab 2"> <h:outputtext value="donec et mi et arcu commodo hendrerit." id="ht2"/> </p:tab> </p:tabview> </h:form> the onchange method empty method test code. i'm missing here can't find what. doing wrong? edit i'm using viewscoped bean. i've tried update="@form" , update=":form" , update=":form:tabview" , same problem occurs. if use update="ht1, ht2" , fine b

encryption - PHP decryption fails on some strings with trim()'s -

i'm having trouble decrypting values end %3d%3d. upon decrypting return value that's illegible. encrypted value being passed via querystring, i've run test looping through values 0 200 rule out problems url encoding. encryption , decryption functions: function encryptvalue($encrypt) { $key = variable_get_local("privatekey", $default = ""); $iv = mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_rijndael_256, mcrypt_mode_ecb), mcrypt_rand); $passcrypt = trim(mcrypt_encrypt(mcrypt_rijndael_256, $key, trim($encrypt), mcrypt_mode_ecb, $iv)); $encode = urlencode(base64_encode($passcrypt)); return $encode; } function decryptvalue($decrypt) { $key = variable_get_local("privatekey", $default = ""); $decoded = base64_decode(urldecode($decrypt)); $iv = mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_rijndael_256, mcrypt_mode_ecb), mcrypt_rand); $decrypted = trim(mcrypt_decrypt(mcrypt_rijndael_256, $key, trim(

asp.net - Submitting a Form now I have added a MasterPage -

i see kinds of questions on google using javascript these things, revolving around problems of asp.net changing ids of everthing, not problem. i have simple form, contained within content page, contains these form elements: <asp:textbox id="coname" runat="server" /> <asp:textbox id="pass" textmode="password" runat="server" /> <asp:button id="enteradmin" text="enter" runat="server" clientidmode="static"/> these wrapped in master page form. my button handling code is: sub submit(sender object, e eventargs) handles enteradmin.click dim company = coname.text dim pwd = pass.text '// more stuff end sub all works when using page standalone page, when add masterpage 2 problems firstly, button click event not triggered. this, have overcome, googling , found adding line: me.registerrequiresraiseevent(enteradmin) fixes problem of click event but, sec

java - Parsing JSON using GSON -

this continuation of previous question. after getting json request , turning json, trying parse result java object. public class netclientget { @suppresswarnings("unchecked") public static void main(string[] args) { string urlyesterday = "http://fids.changiairport.com/webfids/fidsp/get_flightinfo_cache.php?d=-1&type=pa&lang=en"; string yesterdayjson = getdatafromweb(urlyesterday); //system.out.println("yesterdayjson : " + yesterdayjson); //jsonarray.add(yesterdayjson); gson gson = new gson(); list<flightinfo> flightarray = (list<flightinfo>) gson.fromjson(yesterdayjson, flightinfo.class); system.out.println("flightarray : " + flightarray); } private static string getdatafromweb(string targeturl) { try { url url = new url(targeturl); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setrequestmethod("get"); conn.setrequestpro

android - How to parse <strxml>String</strxml> using soap? -

this soap webservice.i have donn. bt got error.this code.can me.how parse string in android. int string int int string string in advance. public boolean callwebservice() { boolean result = false; int patid = 1; string xml = ""; soapobject request = new soapobject(namespace, method_name); request.addproperty("patientid", patid); request.addproperty("appointmentdate", appdate); request.addproperty("timefrom", apptimeto); request.addproperty("timeto", appfrom); request.addproperty("reasonforappointment", appreason); request.addproperty("strxml", xml); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse httptransport = new httptransportse(url); httptransport.debug = true; try {

SSH python script execution taking too much time -

i using python script ssh , connect 2 pc's running iperf commands, script taking lot of time execution. how can reduce execution time: script being run eclipse ide. this script using: import pexpect import pxssh import time import os,re,sys def tc01s(ipaddr,password): try: ss = pexpect.spawn(ipaddr) print ipaddr ss.logfile = open("/tmp/mynewlog", "w") #ss.logfile = sys.stdout print "ssh connecting" print except: print "connection refused" print #sys.exit() try: print password ss.expect (':') ss.sendline (password +"\n") print "connected" time.sleep(30) ss.expect (">") print "connection established" print except: print "permission denied, please try again." print sys.exit() try: ss.sendline ('taskkill /f /i

algorithm - Random exhaustive (non-repeating) selection from a large pool of entries -

suppose have large (300-500k) collection of text documents stored in relational database. each document can belong 1 or more (up six) categories. need users able randomly select documents in specific category single entity never repeated, how stumbleupon works. i don't see way implement using slow not in queries large amount of users , documents, figured might need implement custom data structure purpose. perhaps there paper describing algorithm might adapted needs? currently i'm considering following approach: read entries database create linked list based index each category ids of documents belonging category. shuffle create bloom filter containing of entries viewed particular user traverse index using iterator, randomly select items using bloom filter pick not viewed items. i recommend hash table implementation. ensure constant time ups. can implement technique known linear probing . linked list awful implementation, because eat o(n) on search time.

qt - QRubberBand on a definite label -

strange things happening: need use rubberband on label. here's code: qrubberband *rubberband; qpoint mypoint; void mainwindow::mousepressevent(qmouseevent *event){ mypoint = event->pos(); rubberband = new qrubberband(qrubberband::rectangle, ui->label_2);//new rectangle band rubberband->setgeometry(qrect(mypoint, ui->label_2->size())); rubberband->show(); } void mainwindow::mousemoveevent(qmouseevent *event){ rubberband->setgeometry(qrect(mypoint, event->pos()).normalized());//area bounding } void mainwindow::mousereleaseevent(qmouseevent *event){ rubberband->hide();// hide on mouse release rubberband->clearmask(); } everything works there's 1 trouble - rubberbound starts paint little bit lower coursor set around 100-150px. what doing wrong ? the event->pos() in different coordinate system of label, , rubberband. http://qt-project.org/doc/qt-4.8/qwidget.html#mapfrom http://qt-project

tsql - Random number in table SQL Server -

please me create table university ( id int, firstname nvarchar(100), lastname nvarchar(100) ) need id automatically taken randomly different numbers. must 10 numbers wihout logic. example: 5478596256 bob brown 9852451254 tom jones 7078596585 jason sadler consider creating unique, sequential id . create table student ( -- start @ 1 , increment 1 id int identity(1,1) primary key, firstname nvarchar(100), lastname nvarchar(100) ) another option create uniqueidentifier (guid) create table student ( id uniqueidentifier not null default newsequentialid() rowguidcol primary key, firstname nvarchar(100), lastname nvarchar(100) ) personally, sequential id. it's easier debug key if it's simple integer rather unwieldy guid. manually punching in sql testing/debugging frustuarting when having punch in guid , formatting correct. also, sequential id gives way of looking @ record order.