Posts

Showing posts from September, 2011

sqlite - Android SQLiteDatabase query with WHERE clause -

i have sqlitedatabase called "database". in there table called "pics". in table there 3 columns follows, drawablename text,drawablereference integer,picturerating real. want query database integer expect in drawablereference column. want can corresponding drawablename , picturerating same row. wrong query? public class edititemactivity extends activity { edittext textfield=null; ratingbar ratingbar=null; sqlitedatabase db=null; cursor dbcursor=null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent=getintent(); integer imageid=intent.getintextra("imageid",-1); if(imageid==-1){ return; } string id=imageid.tostring(); //not used right setcontentview(r.layout.edit_item_layout); db=this.openorcreatedatabase("database",this.mode_private,null); string selection="drawableref

How to hide media files on SD card in Android? -

i developing 1 android application, here i'm downloading media files , want keep files private application. files size large, it's not possible store in internal storage because may affect phone storage , create memory issues. encryption , decryption of media files takes more time process. possible store files safe in external storage. files want store should not accessed applications , when connected pc should not visible. any appreciated. in advance. // path sdcard file sdcard = environment.getexternalstoragedirectory(); // path add new directory path file dir = new file(sdcard.getabsolutepath() + “/your-dir-name/”); // create directory if not created dir.mkdir(); // create file in write contents file file = new file(dir, “my-file-name.txt”); fileoutputstream os = outstream = new fileoutputstream(file); string data = “this content of file”; os.write(data.getbytes()); os.close();

java - HashTable without Collections Library -

i trying create basic file system. not allowed use collections library. file system stores 2 types of data files , directories . types file , directory both subclasses of abstract type entry . my design far my hash function take name of entry , convert each char in name integer , sum them 1 value. next mod value size of array determine placed protected static int hashfunction(string entryname) { char[] = entryname.tochararray(); int sum = 0; // convert string integer value (char b : a) { sum += (int) b; } int hashvalue = sum % hashtablekey; return hashvalue; } what having trouble designing hash table. currently, once hash function computes value, store name of entry ( entryname ) in array relative hashvaue . store actual objects in array of same size hold these objects. storage of these objects have same index respective names in array hold object's names. *objects can either file or directo

c# - Create XSLT for XML from XML -

i have convert xml xml through xsl. have following xml <?xml version="1.0" encoding="utf-8"?><skos xmlns="http://www.w3.org/2004/02/skos/core#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#"> <skos:descriptor id="7769" tagno="111" isvalid="true"> <skos:altlabel>abyssinian expedition (1867-1868)</skos:altlabel> <skos:preflabel>abyssinian expedition (1867-1868)</skos:preflabel> <skos:broader>ethiopia -- history -- 1490-1889</skos:broader> <skos:broader>great britain -- history -- victoria, 1837-1901</skos:broader> <skosxl:hiddenlabel>expedition abyssinia (1867-1868)</skosxl:hiddenlabel> <skosxl:hiddenlabel>british expedition abyssinia (1867-1868)</skosxl:hiddenlabel> <skosxl:hiddenlabel>magdala cam

Why do I have an error in the pointer in C? -

i starting learn pointers in c. why have error in line 8 @ &i ? this source: char * func(char *d, char *str) { return d; } int main(int argc, char *argv[]) { char *i = null; func(&i, "aaa"); // line 8. here have error (in "&i") } the type of &i not char * char * * . you should go through how pointer pointers work in c?

javascript - Adding Handler to Document event change the scope to document in Sencha Touch -

my problem when adding listener document click event, inside handler scope set document object, not able access method defined inside container object. mycode : ext.define('myapp.view.controlpanel.controlpanel', { extend: 'ext.container', alias: "widget.controlpanel", requires: [ 'ext.segmentedbutton' ], config: { layout: { pack:'stretch' }, docked:'bottom' }, documentclickhandler:function(){ console.log('document clicked'); //here throw exception, because here document object not container object var settinglistcontainer = this.down("#setting-list-container"); if (settinglistcontainer) { this.remove(settinglistcontainer, true); }, onsegmenttoggled: function (container, button, pressed) { console.log("toggle event"); var

php - No such file or directory: /etc/ssl/certs/example-cert.pem -

i'm using drupal wit nginx . rroot /var/www/example.com , , i'm using php-fpm method. after running through pretty typical troubleshooting, ran error can find 1 other instance of via google search: bio_new_file("/etc/ssl/certs/example-cert.pem") failed (ssl: error:02001002:system library: fopen:no such file or directory:fopen('/etc/ssl/certs/example-cert.pem','r') error:2006d080:bio routines:bio_new_file:no such file) i've tried commenting out https server in sites-available config file, continue error. on fresh instance of ubuntu 13.10 on aws.

unity3d - Particles not responding properly to gravity issue -

for odd reason when apply gravity particle system, of particles fly left downward. supposed fly , down when add gravity reason why it fly s left. know problem might be? your coordinate system broken. gravity applied in downwards direction globally, if global down points towards left side, explain effect. the same applies if movement not straight up. depending on how implement upwards movement, applying gravity cancel out upwards components of movement , pull particles down, if have leftwards component in movement, continue apply , result in particles drifting away.

c# - how to import media library in windows store app? -

i made media player windows store app used filepicker pick file pc play. want import music library , video library , show content in homescreen make easy selecting files play. how it? please help.. i'm using c# , xaml app. to this, must use knownfolders class. must first add music library , videos library capabilities in app manifest, can access them via class.

math - given "N" find p & q such that p+q=N and p*q is maximum -

i need logic/idea behind rough solution have come with. the problem is: given n, 1<=n<=1000000 need find 2 numbers p , q such p + q = n && p * q = maximum. i chose use (((n+1)/2)*((n/2))); gives me maximum product minimum sum. kind of interested in proof of logic. any or leads? #include<stdio.h> typedef unsigned long uint; unsigned long calc(uint); int main(void) { short = 0; uint k = 0; scanf("%i", &i); while(i--) { scanf("%lu", &k); printf("%lu\n", calc(k)); } return 0; } uint calc(uint k){ return (((k+1)/2)*((k/2))); } let f(p) = p * (n - p) = p * n - p ^ 2 then: f'(p) = n - 2 * p f''(p) = - 2 since f''(p) < 0 , solving f'(p) = 0 gives local maxima . when f'(p) = 0, p = n / 2 => q = n / 2 you need test end-points f(0) , f(n) , both of these evaluate zero, our maxima global maximum. note: saying of rect

cross domain - Chrome only error : Blocked a frame with origin "https://apis.google.com" from accessing -

i have followed google+ api's guidelines put signin button in web app. works firefox not chrome : same origin error : blocked frame origin "https://apis.google.com" accessing frame origin "https://mysite.com". , have declared https://mysite.com "javascript" origin in https://console.developers.google.com . i don't it, it's browser , thei api's doesn't work it... can me overcome cross-domain problem chrome ? (this more of comment full answer don't have sufficient reputation comment.) i ran same problem following python sample app instructions, also: https://developers.google.com/+/quickstart/python i had couple chrome extensions running can modify page content: jsonview , stayfocusd. after disabling these extensions , trying again, worked me. oddly can't seem repro problem extensions re-enabled. seems worth try?

c++ - BOOST_FOREACH iterating rvalue container has error with non const ref value -

i'm using g++ 4.4.7 20120313 class obj { int a; } std::list<obj> list; boost_foreach(obj& v, list) { } // ok boost_foreach(const obj& v, list) { } // ok std::list<obj> getlist() { ... } boost_foreach(obj& v, getlist()) { } // error: invalid initialization of reference of type 'obj&' expression of type 'const obj' boost_foreach(const obj& v, getlist()) {} // ok why got error? why should use const obj& instead of obj& ? we can simplify following: int f() { return 99 ; } int main() { const int& p = f() ; // ok int& p = f() ; // error: invalid initialization of non-const reference // of type ‘int&’ rvalue of type ‘int’ return 0 ; } does make more sense you?

java - Maven - release snapshot dependencies -

so have 2 projects, lets call them projecta, , projectb. projecta , projectb should released independently of each other. both use shared project called projectcommon. <groupid>group</groupid> <artifactid>projecta</artifactid> <version>0.0.10-snapshot</version> <dependencies> <dependency> <groupid>group</groupid> <artifactid>projectcommon</artifactid> <version>0.0.2-snapshot</version> </dependency> </dependencies> currently if want realease projecta, first have release projectcommon, , update version in projecta pom.xml. is there way automate this? have been looking @ versions:use-latest-releases plugin cant work if projectcommon using snapshot. "cant release project due unreleased dependencies" thanks you should use released version of projectcommon in other projects, way have 2 scenarios. 1) make changes in projectcommon , re

automation - Coded UI Test Fails to find Wpf Popup Window controls -

i trying automate ribbon control in power point. in ribbon there popup windows contains settings information, when try automation setting popup windows using coded ui, got error message "the control cannot located playback fail find control give search properties", coded ui can find popup window fails find controls inside it.i have tried searchconfiguration.alwayssearch , setfocus() does 1 have solutions, helpful me! find parent object, i.e popup window, , enumerate through children objects manually if codedui not able locate objects. ienumerator<uitestcontrol> appt = uimainwindowcontrol.getchildren().getenumerator();

javascript - Making async call dropboxjs -

i have problem when want read directories dropbox api, dropbox.js https://github.com/dropbox/dropbox-js the read directories function the api looks , want assign value angular reach in html. update after helpful question client.readdir("/", function(error, entries, stat1, stat2) { if (error) { return showerror(error); } $scope.dbitems = stat1; $scope.$digest(); }); the html-code: <ul ng-repeat="dbitem in dbitems"> <li><input type="image" src="img/folder.png">{{dbitem.name}}</input></li> </ul> my problem dropbox call takes milliseconds have reload page print data collected. i've tried things both angular , jquery promises can't work. examples find promises has settimeout-function , easy implement when try implement dropbox doesn't work. has tried similar? update problem now html updated correctly want j

magento - Is it possible to put the gateway into step 5 rather than the bottom of the page (means at payment information tab)? -

i using paypal website payments pro hosted payment gateway time shows @ bottom of page (after order review). is possible put gateway step 5 rather bottom of page (means @ payment information tab)?. if have idea it, please reply asap. here link of website: http://dev.blokeundees.com.au/

jquery - Joomla 3: Serialize javascript object and save in session via Ajax -

i have script on joomla page must send javascript object this: { "44-00-22": "1" } i want send via ajax controller , store in the session. ajax call looks this: url='index.php?option=com_mycom&task=savebasket&format=raw'; var data = "request=" + json.stringify(basket); $.ajax({ type: "post", data: data , url: url, success: function(data) { squeezebox.open("index.php?option=com_basket&view=basket&tmpl=component",{ handler : 'iframe', size : { x : 600, y : 450 } }); } }); the method in controller: public function savebasket (){ $input = jfactory::getapplication()->input; $request = $input->get('request', ''); $session = jfactory::getse

Running java main program using maven -

while running executing maven main class using below command: mvn exec:java -dexec.mainclass="com.xoxo.amqtest.subscriberdriver" i assumed jars must picked maven repo. instead throws below exception. java.lang.noclassdeffounderror: com/xoxo/infra/protectedpkg/protectedpackageloadexception this maven project runs fine in eclipse. there way specify maven pick dependencies maven repo instead of adding dependencies below java -cp ./:./target/amq-subscriber-1.0.0-snapshot-jar-with-dependencies.jar:/x/home/stvu/.m2/repository/com/xoxo/submodule/infra-jsse-2.0.1.jar com.xoxo.amqtest.subscriberdriver edit: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> &

css - How to make input type text auto-expand also set specific width expand. -

i have search field doesn't align want here code #menu_search{ position: absolute; width: 100%; max-width: 1280px; display: inline; float: right; right: 0px; z-index: 99; } so want search in right part of screen max 1280 px, otherwise maintain alignment 1280px (center of screen) --------------------------------1480px----------------------------- xxxxxx----------------------1280px----------[search]xxxxxx check jsfiddle html <input id="menu_search" type="text" size="20" placeholder="search here..." /> css #menu_search{ position: absolute; width: auto; max-width: 1280px; display: inline; float: right; right: 0px; z-index: 99; } j-query (library 1.7.2) $(function(){ $('#menu_search').keyup(function(){ var size = parseint($(this).attr('size')); var chars = $(this).val().length; if(chars >= size) $(th

html - Moving a div down -

i working website , having problem cant move navigation bar down in header. worried it. here jsfiddle: http://jsfiddle.net/2qlz4/ the target make in header: https://www.dropbox.com/s/m2ijroj58vey2rf/target.png nothing worry about. add this: ul#nav, ul#nav ul { list-style: none outside none; margin: 40px 20px 0 0; } see demo: http://jsfiddle.net/2qlz4/1 /

apache - Apache2 - Rewrite rule not working (Remote address) -

does have idea, why rewrite rules in apache2 configuration not working? <virtualhost *:80> rewriteengine on rewritecond %{remote_addr} ^192\.168\.123\.121$ rewritecond %{remote_addr} ^192\.168\.1\.107$ rewritecond %{remote_addr} ^10\.17\. rewriterule ^(.*)$ /var/www/html/$1 documentroot "/var/www/html/phones" servername 127.0.0.1 </virtualhost> what want is, if clients ip addresses 192.168.123.121, 192.168.1.107 or network 10.17.x.x come web server port 80, redirected different path (/var/www/html/) other ip addreses (/var/www/html/phones/)? as far know multiple rewrite conditions 1 rewrite rule combined logical and. hence try "or next condition" (or) option: rewritecond %{remote_addr} ^192\.168\.123\.121$ [or] rewritecond %{remote_addr} ^192\.168\.1\.107$ [or] rewritecond %{remote_addr} ^10\.17\. btw: maybe it's helpful activate logging, too. can use like apache < 2.4 rewriteengine on rewritelog "/var/lo

jquery - sending an ajax GET with a javascript response format -

i trying following $("select.languages").on("change", function(){ var lang = $(this).find("option:selected").text(); $.get(url: "/search", data: {"lang": lang}, datatype: 'script'); }); so every time language selected call /search language , other answers make datatype "script" but doesn't quite work. work $.get( "/search.js",{"lang": lang} ) yet pollutes url since format explicit , doing using method requires me add pointless code can implicitly set response format? try instead: $.ajax({ url: "/search", data: {"lang": lang}, datatype: 'script' }); the get shorthand method not accept parameters object this.

How would I modify this Wordpress theme? -

Image
i have purchased imagpress theme , have been able modify structure using firebug cannot workout add modifications needed. it home 5 i have deleted top menu in firebug , modified margins etc. any appreciated :) there should option add custom css theme on ride styles. found in theme settings. if there not custom css area, can access css somewhere around appearance > editor . if navigate style.css can apply changes there. however using method undo changes made if update theme, suggest using child theme :) there several benefits using child themes, few are: modifications css not reverted if theme updated allows user experiment design of theme without potentially destroying original code! i won't mention more can found in link provided. hope helps!

c# - changing Datatype of DataTable using decimal -

i comparing 2 datatables , built new table want sort values in new table since has -ve values(if not converted decimal -ve sign not considered) want convert decimal type string , return table sorting. getting error input string not in correct format how solve this?and sort -ve values in asc order private static datatable comparetwodatatable(datatable table1, datatable table2) { datatable table3 = new datatable(); datarow dr = null; string filterexp = string.empty; (int = 0; < table1.rows.count; i++) { string col = table1.rows[i]["parameter name"].tostring(); if (table2.columns.contains(col)) { if (!table3.columns.contains(col)) { table3.columns.add(col, typeof(string)); filterexp = filterexp + col + " asc ,"; } (int j = 0; j < table2.rows.count; j++) { if (table3.rows.count != table2.rows.count)

javascript - jQuery hover issue on second function (mouseout) -

having issue .hover() on mouse'ing out. doesn't seem work. works on fade in, not out. fading in image on top of it. 'clone' has lower z-index start, , bring forward , fade in on hover. both images stacked. the fiddle: http://jsfiddle.net/c6afm/ the javascript: $.fn.hoverimage = function() { //add event handler each image (otherwise add same event handler images @ once) this.each(function() { var img = $(this); var magnifyimage = img.next(); //hover: first function mouseover, second on mouseout img.hover(function() { magnifyimage.css("z-index", 2).animate({ opacity:0.8 }, 200); }, function() { magnifyimage.css("z-index", -200).animate({ opacity:0 }, 200); }); }); } the html: <span class="img-span"> <img src="(url)&qu

Few (specific everytime) contacts duplicated during insert in android -

i trying insert list of contacts in android using contact api. facing strange problem that. of contact getting duplicated if exist in phone book. happens few of contacts not contacts confused me more. here code. final arraylist<contentprovideroperation> restoredcontactlist = new arraylist<contentprovideroperation>(); restoredcontactlist.clear(); restoredcontactlist .add(contentprovideroperation .newinsert( contactscontract.rawcontacts.content_uri) .withvalue( contactscontract.rawcontacts.account_type, maccounttype) .withvalue( contactscontract.rawcontacts.account_name, maccountname).build()); (int j = 0; j < namesarray.length(); j++) { final jsonobject nameobj = namesarray .getjsonobject(j); restoredcontactlist .add(contentprovideroperation .newinsert( contactscontract.data.content_uri) .withvaluebackreference( contactscontract.data.raw_contact_id,

python - Avoid using two arrays to make a simple string change -

i've list json file names , want remove .json words. what i've done , works is: jsonlist = ['foo.json', 'bar.json'] jsonlist_parsed = [] in jsonlist: x = i.replace(".json", "") jsonlist_parsed.append(x) jsonlist_parsed prints me desired solution, ['foo', 'bar'] is there way avoid using 2 arrays , doing change in jsonlist array? thanks in advance you can use list comprehension, this jsonlist = ['foo.json', 'bar.json'] print [item.replace(".json", "") item in jsonlist] # ['foo', 'bar']

Java Manifest not working on Windows 8 -

i made jar program "ablauncher v0.1.0.jar" , ran successfully. but when gave windows 8 user, he says got error while running on cmd: cannot find or load main class ablauncher but, main class specified manifest launch.launch, not 'ablauncher'. 'ablauncher' jar name: ablauncher v0.1.0.jar. can explain why error happens? manifest file was: manifest-version: 1.0 main-class: launcher.launcher file directory setting was form/ launcher/ (launcher/launcher.class main class) meta-inf/ resource/ server/ settings/ util/ of course other class files exists here, couldn't write of them... , there's nothing like: ablauncher.class

How to test controller created via module.config in angularjs -

i have controller defined in following manner, works perfect. when try test controller says "(controller name)" not function, got undefined". how can test controller defined way. controller.js var mainmodule = angular.module('module1'); function home($scope) { $scope.test = "hello"; } home.$inject = ["$scope"]; mainmodule.config(['$routeprovider', function ($routeprovider) { $routeprovider.when('/', { templateurl: 'partials/home.html', controller: home }); } ]); testspec.js describe("test home controller", function () { beforeeach(module('module1')); it("test controller ", inject(function ($rootscope, $controller) { var ctrl = $controller("home", { $scope: $rootscope }); expect($rootscope.items.length).tobe(3); })); }); as mentioned in comments @paolomoretti, shou

java - android notification comes up on start -

i m trying create app, schedule notification whenever try open app, notification comes up..... comes @ right time when app opened. here's code............ main activity.java public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); calendar calendar_object = calendar.getinstance(); calendar_object.set(calendar.hour_of_day,16); calendar_object.set(calendar.minute,18); calendar_object.set(calendar.second,00); intent myintent = new intent(mainactivity.this, alarmreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(mainactivity.this, 0, myintent,0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(context.alarm_service); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, calendar_object.gettimeinmillis(),120000,pendingintent); } } alarmreceiver.java public class alarmrece

Error while running program made in vb.net -

i encountered following error while running program on computer. please me solve. installing vb power pack solved of problem still there these errors on part i have installed proper .net framework too ************** exception text ************** system.invalidoperationexception: collection modified; enumeration operation may not execute. @ system.throwhelper.throwinvalidoperationexception(exceptionresource resource) @ system.collections.generic.list`1.enumerator.movenextrare() @ system.collections.generic.list`1.enumerator.movenext() @ microsoft.visualbasic.powerpacks.shapecollection.dispose(boolean disposing) @ microsoft.visualbasic.powerpacks.shapecontainer.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.control.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.control.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windo

How to change JQuery Terminal prompt from another function? -

i using http://terminal.jcubic.pl/ create jquery terminal. i want change prompt after user logged in. example. want change prompt root@mac #: i bit new jquery. please help. // how create terminal var terminal = $('#jq_terminal').terminal(function(command, term) { term.echo("you typed " + command); }, { login: f_login, greetings: "you authenticated", prompt: '#', name: 'shell', onblur: function() { return false; } }); // login function f_login(user, password, callback) { // make soket.io call here. socketio call f_login_response } // login response here function f_login_response(user, password, callback) { // how change terminal prompt here ? // tried terminal.prompt = '$'; // not work } the prompt can function: var login = false; var terminal = $('#jq_terminal').terminal(function

node.js - Multi-dimensional array in Mongoose schema -

how can define multi-dimensional array in mongoose schema? want have 2d array in mongoose schema in order locate room in hotel this. var room = new schema({ number: number, type: string, // room type id }); var hotel = new schema({ ... rooms: [[room]] }); here's error get... d:\projects\hotelbox\node_modules\mongoose\lib\schema\array.js:58 this.caster = new caster(null, castoptions); ^ typeerror: object not function @ new schemaarray i can fix defining rooms schema.types.mixed can't validate room data @ time of creation. afaik, there no such support in mongoose multidimensional arrays utilisation. that being said, , have been pointed, can workaround using schema.types.mixed schematype, lose goodies came use native mongoose types. however, can overcome definining own validation s using custom validators , pointed @ official docs (they easy use). caveat custom validations triggered when saving instance. if need trig

wpf - update notification in WP app -

i want create update notification in wp app, when publish new version app in main screen displayed pop-up text available new version. how can it? can data last version app market? see http://www.pedrolamas.com/2013/07/24/checking-for-updates-from-inside-a-windows-phone-app/ code checks if there newer version available. see http://dotnetbyexample.blogspot.com/2013/09/zero-lines-of-code-solution-for-in-app.html easy integration in app.

multithreading - How to make my script wait till the previous command completes? -

i have following perl script code install oracle db application. system("./runinstaller -silent -responsefile filename.rsp"); if($?==0) { //perform operation type1; } else { //perform operation type2; } in code execution of if block should performed after complete installation of application. script runs parallel installer. i have used both `` , exec instead of system, none works needed. help me in solving this. thanks in advance. using of -waitforcompletion option of runinstaller makes script wait till complete execution. now: system("./runinstaller -silent -responsefile filename.rsp"); will become system./runinstaller -silent -waitforcompletion -responsefile filename.rsp"); for more info on runinstaller click here

ios - Autoadjust content of UILabel -

i have determined bounds of uilabel . single line, 2-3 words. have change font size. best solution adjust content determined rectangle programmatically? set minimum font scale of label _mylabel.adjustsfontsizetofitwidth = yes; _mylabel.minimumscalefactor = 0.5f;

ios - Extends Edges in iOS7 using XIB -

Image
in ios 7 when use storyboard, view controller can remove top , bottom bar using extends edges in xib file unable find extends edges when search this, got if ([self respondstoselector:@selector(edgesforextendedlayout)]) self.edgesforextendedlayout = uirectedgenone; its working fine in ios7 simulator still have problem in ios6 simulator… also interface builder - view “ios6 6.1 , earlier” , ios 6/7 deltas y 15 still can’t it. refer images just push viewcontroller (xib file) using navigation controller… can 1 me whats wrong in it, how may fix this

c# - Send http header from wcf web service to android -

i calling wcf rest service android.suppose method calling. public employee getemployee(int empid) { employee emp = null; using (idatareader reader = datamanager.executereaderprocedure(storedprocedures.getemployee, empid)) { while(reader.read()) { emp = new employee(); emp.id = reader.getint32(0); emp.fullname = reader.getstring(1); emp.designation = reader.getstring(2); } } return emp; } now not able how send information in http header method. appreciated. you can use weboperationcontext. system.servicemodel.web.weboperationcontext.current.outgoingresponse.headers.add("cache-control", "no-cache"); edit i have used cache-control example here can specify valid http header. second parameter value wish set.

Android Facebook api 3.7- ApiException:The app must ask for a basic_info permission at install time -

i'm using sdk 3.7 android application doen't use fb authentication, have share button. on button click, trying create session , open fb webdialog, when i'm getting dialog asks me publish permission , after session doen't opened , i'm getting com.facebook.facebookauthorizationexception: unknownerror: apiexception:the app must ask basic_info permission @ install time. i tried: 1. add 'basic_info' permission. 2. uninstall app , fb app , install again. how solve problem? (see code below) @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); boolean isfacebookresponse = session.getactivesession().onactivityresult(this, requestcode, resultcode, data); if (isfacebookresponse) { } } @override public void onfacebookshareclick() { checkfacebooklogin(

c# - saving session data once authenticated .net -

so i'm building web application in .net using c#, mvc , sqlexpress. want users able login , depending on group belong to, see part of ui. i have created tables groups , users in database, created models tables using ado.net wizard model creation. i have added controller has methods checking if user exists, , if password correct. question how store information user authenticated "©correct" way? at moment, create new object in session variable made available system.web.mvc.controller . have made flag object session["authenticated"] = true , created object holds information (username, group affiliation etc...) session["user"] . i have stumbled upon articles describe implementing own membership provider ( here , here ) feel need break existing classes password security , account control in order implement them inside of custom membership provider. is custom membership provider implementation necessary or data saved in session enough?

Obtaining process output with Java doesn't display all the content -

i executing processes java , parsing results. however, when read output don't content. for example, if execute windows console: cmd /c tasklist | find "java" it shows: javaw.exe 6192 console 1 683.668 kb java.exe 8448 console 1 35.712 kb java.exe 7252 console 1 35.736 kb javaw.exe 3260 console 1 76.652 kb java.exe 9728 console 1 35.532 kb but if same java process 2 of them appear: java.exe 8448 console 1 35.712 kb javaw.exe 3260 console 1 76.652 kb this simplified version of code: public static void printpidsofjavaprocesses() { try { string[] params = null; if (isinwindows()) { params = new string[6]; params[0] = "cmd"; params[1] = "/c"; params[2] = "tasklist"; params[3] = "|"; params[4] = "find"; params[5] = "\"java\&q

reporting services - SSRS Multi Value Matrix Field -

Image
i have data follows: week week_day day_name date record 1 4 wednesday 2014-01-01 null 1 5 thursday 2014-01-02 im13368 1 5 thursday 2014-01-02 im13377 1 6 friday 2014-01-03 im13381 1 6 friday 2014-01-03 im13364 1 7 saturday 2014-01-04 null now want data represent matrix report via ssrs (calendar-like), if there 2 or more values same week , weekday, matrix's field shows 1 value, not of them. how can force report show of them in specific day? you have click matrix , select hideduplicates none. in image below: maybe this topic might you: as this other one .

php - Using MySQL functions in Propel ORM -

i need in writing following raw mysql query in propel orm in "symfony 1.1.9" framework contains mysql functions in select , where. select date( u.date ) date, time( u.date ) time, u.id account_id, u.user_name , if( ( select count( id ) bank user_id = u.id , date( creation_date ) > date_add( curdate( ) , interval -30 day ) group user_id ) , 'y', 'n' ) deposited user u date( u.dat ) > date_add( curdate( ) , interval -30 day ) i searched lot this. could't relevant solution. tried many possible solution. nothing works. note i'm not prefer use raw query . please help. appreciated. in advance. the best article have found 1 on page: http://propelorm.org/reference/model-criteria.html#using-a-query-as-input-for-a-second-query-table-su refer section of subqueries. to started might try following (i haven't tested it's bound have bugs): $deposited

if statement - awk: printing FILENAME once when criteria are met several times in a file -

i have series of files , know ones meet criteria (egs. $1 == "ice" && $2 == "cream"). criterion met several times in same file. awk print filename once when criterion met. i hope made myself clear. try (nextfile gnu extension): awk '$1=="ice" && $2=="cream"{print filename;nextfile}' file1 file2 file3 or if don't have gnu: awk 'fnr==1{p=0} $1=="ice" && $2=="cream" && !p {print filename;p=1}' file1 file2 file3 the fnr==1 resets p flag @ start of each file, , when criteria met, p flag gets set 1 filename comes out once. by way, may prefer simplicity of this: grep -l "^ice.*cream" file* it not identical, pretty similar. edited after acceptance this possibility may more elegant. saves names of matching files in array names[] , prints keys of array names[] @ end. awk '$1=="ice" && $2=="cream" {name

How to render content outside of drupal instance -

i created 1 website using drupal. in drupal crated content pages in instance using wisywig editor. intention using content block outside of drupal. can please me how use content block outside of drupal (with code or else). i mean how render content outside of drupal instance rendering blocks , nodes straight-forward. before can either must initiate drupal core: define('drupal_root', getcwd()); require_once drupal_root . '/includes/bootstrap.inc'; drupal_bootstrap(drupal_bootstrap_full); using getcwd() assumes placing script in drupal's root. to display blocks, use block_load() : $blocks[] = block_load('block',$delta); //first block display $blocks[] = block_load('block',$delta2); //second block display print drupal_render(_block_get_renderable_array(_block_render_blocks($blocks))); for nodes, there several approaches. node_view( node_load() ) seems cleanest: print drupal_render(node_view(node_load($nodeid)));

How to perform Localization using sqlite stored data-iOS App? -

in app doing localization support mutiple languages. creating .string file , using following method: -(nsstring*) languageselectedstringforkey:(nsstring*)key; i using key_value concept this. working fine. question is: let have sqlite database has different languages string needs localized. for eg: for spanish "username" = "nombre de usuario"; "password" = "contraseƱa"; "submit" = "presentar"; for french "username" = "nom d'utilisateur"; "password" = "mot de passe"; "submit" = "soumettre"; all insert in sqlite database . how can perform localization app way? since seem have strings traduction within 1 db, need have intermediate data structure act bridge between db , method localize string. you make use of dictionary e.g store key string identifier , value array contain languages traduction. need feed data structure once then. not

winforms - How to set DataPropertyName to a property of a Inherited object in C#? -

i have datagridview , bindinglist , bindingsource fill it. objects i'm using fill datagridview this: public class mybaseclass { public int someproperty {get; set;} public mybaseclass(int sp) { someproperty = sp; } } public class myderivedclass : mybaseclass { public int anotherproperty {get; set;} public myderivedclass(int sp, int ap):base(sp) { anotherproperty = ap; } } my datagridview can have list both of objects, don't know how set datapropertyname of datagrid column anotherproperty in inherited class. possible? it's possible. see answer: https://stackoverflow.com/a/22078353/2878550 refers fields, can adapt case implementing different logic in mycustomtypedescriptor.getproperties method.

xamarin.ios - MvvmCross: PictureChooser Plugin - Preview screen Button Text -

is there way change text in ios , android 2 buttons showing inside picture preview screen after take photo using mvvmcross picturechooser plugin? i have searched on can't seam find anything. thank you! there's no way provided mvvmcross this. the source code picture chooser in https://github.com/mvvmcross/mvvmcross/tree/v3.1/plugins/cirrious/picturechooser on droid, uses standard actiongetcontent intent - https://github.com/mvvmcross/mvvmcross/blob/v3.1/plugins/cirrious/picturechooser/cirrious.mvvmcross.plugins.picturechooser.droid/mvxpicturechoosertask.cs#l37 on ios, uses standard uiimagepickercontroller - https://github.com/mvvmcross/mvvmcross/blob/v3.1/plugins/cirrious/picturechooser/cirrious.mvvmcross.plugins.picturechooser.touch/mvximagepickertask.cs so customise these, you'll need replace code or see if there "standard" ways on each platform.

java - Serializing and deserializing prepared queries in ORMLite -

is there way serialize ormlite prepared query , deserialize restore original form? in android passing parameters activities or fragments must done in serialized form. seems impossible pass prepared queries arguments in bundle . serializing them not problem because there preparedstmt<t>.getstatement() have not found way reverse process. there solution of putting query in map string key, passing key argument , retrieving query using key, searching simpler solution. is there way serialize ormlite prepared query , deserialize restore original form? right answer no , don't think there way code changed support it. prepared query contains points dao, internal connection source classes, etc. can perform duties. there no easy way serialize information @ time. serializing them not problem because there preparedstmt.getstatement() have not found way reverse process. by reverse process mean generate preparedstmt query string? should able do: gener