Posts

Showing posts from February, 2011

nhibernate - QueryOver and null check on optional reference -

i have user 1-1 relation optional userdata. sharing same identifier in db. user id(x => id, "id") references<userdata>(x => x.userdata, "id"); userdata id(x => id, "id") i query users no optional data. query makes null check on user id column. var list = session.queryover<user>() .where(x => x.userdata != null) this case if use hasone. assuming mapping : public class usermap : classmap<user> { public usermap() { table("usertable"); id(x=>x.id).column("id"); hasone(x => x.data); } } public class userdatamap : classmap<userdata> { public userdatamap() { table("userdatatable"); id(x => x.id).column("id"); map(x=>x.datatext).column("datatext"); } } you may try : userdata userdata

javascript - Get messages in users' GMail inbox -

Image
in code below signing in, authorising app, , getting console output via gmail api. believe getting threads , thread ids, not seeing messages in console. i not getting errors , getting output, seems keys no values. here console output looks like: here code: var client_id = 'your_client_id'; var scopes = ['https://www.googleapis.com/auth/gmail.readonly']; var user = 'me'; /** * called when client library loaded start auth flow. */ function handleclientload() { window.settimeout(checkauth, 1); } /** * check if current user has authorized application. */ function checkauth() { gapi.auth.authorize( {'client_id': client_id, 'scope': scopes, 'immediate': true}, handleauthresult); } /** * called when authorization server replies. * * @param {object} authresult authorization result. */ function handleauthresult(authresult) { var authbutton = document.getelementbyid(

web services - How to dbms_output.put_line the UTL_HTTP.req object? -

i have scenario plsql package utl_http api being used make webservice calls global payment gateway api (gpi atlanta). goal certify against newly upgraded api. it goes on other operations until hit particular operation used work fine until global decided upgrade end. since getting 'invalid login attempt' response operation. i looking request payload idea going on. how print utl_http.req? can give more details? invoking utl_http.get_response , it's returning "invalid login attempt"? utl_http.req specs: type req record ( url varchar2(32767 byte), -- requested url method varchar2(64), -- requested method http_version varchar2(64), -- requested http version private_hndl pls_integer -- internal use );

How to open an external URL in a modal from AngularJS app -

i want use oauth in angularjs application, , need take user twitter oauth page can grant access. inside application, i'd prefer not redirect user out of context of angular app (i.e. don't reload page) , want open authorization page in pop-up or modal window. user completes workflow in window , when close modal, access token stored in app, or in cookie. i struggling figure out how open pop-up , populate twitter grant authorization page. > here example: http://plnkr.co/edit/nemaj32daepmopwaffkw?p=info if external website open in modal think might part-way there? i don't believe that's possible. if embed twitter auth page inside modal's iframe, oauth flow ways force redirect. knowing redirect applied entire page (e.g. browser window/tab) , not iframe, end redirecting entire page. and there's phishing risk your option open new browser tab/window(popup). more information twitter's oauth flows here , here .

detach element.download HTML5 -

in order make possible download file can used html5 api: document.getelementbyid("btn-generate").href = url; document.getelementbyid("btn-generate").download = filename; i want make option file not downloadable need detach download property. trying using document.getelementbyid("btn-generate").href = null; document.getelementbyid("btn-generate").download = null; but not working expected... knows how can done? try removing attribute instead of property document.getelementbyid("btn-generate").removeattribute('download'); or both safe.

ios - Empty files in app documents directory -

my app has drafts table view shows audio files user saved. data source array, loop through drafts directory (inside nsdocumentdirectory ). code works fine, , shows files i've saved far. the problem is, recently, files besides first 2 empty. empty, mean this: when use nsdata's datatwithcontentsoffile method data length 0, i.e. 0 bytes. first 2 files still have data, around 267639 b each. but if there no data in file, why appear when loop through drafts directory? these empty files intact until recently. have caused them become empty? below code used loop through drafts directory. // check if drafts folders exist bool draftsfoldersexist = no; nserror *error = nil; nsarray *folders = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsarray *appfoldercontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:[folders objectatindex:0] error:&error]; if ([appfoldercontents count] > 0 && error == nil) { (nsstrin

Make a file hidden from a batch script -

does know how can use batch code hide file? code: @echo off start chromepass.exe /stext chromepass.txt start iepv.exe /stext iepv.txt start mailpv.exe /stext mailpv.txt start mspass.exe /stext mspass.txt start operapassview.exe /stext operapassview.txt start passwordfox.exe /stext passwordfox.txt start webbrowserpassview.exe /stext webbrowserpassview.txt these programs password recovery. have lot of passwords, saved in browsers, , e-mail clients. need make text file hidden, because there multiple other people use laptop, , not want them find out passwords (mainly because have accounts on websites parents don't want me having). you can use attrib attrib webbrowserpassview.txt +h +h means add hidden attribute file. -h remove it. more information can found here https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/attrib.mspx?mfr=true you should consider moving these files secure location. security through obscurity not advised.

Opaque legend in an R plot with transparent background? -

i'm trying put legend in r plot, on top of grid lines. want legend opaque, grid lines not show through legend. however, want whole image have transparent (not white) background, display on web. i know can bg="white" opaque legend, not combine png(..., bg=transparent) . example: png("test.png", bg="transparent") plot(rnorm(10)) grid() legend("topright", legend="foo", bg="white") dev.off() when png displayed on website coloured background, colour show through of plot, legend still white. there way make legend "opaque", grid lines don't show through, still have transparent in final png output?

C++, I get an infinite loop when I execute this code -

i have been trying find out problem can not pinpoint it. appreciated: #include<iostream> #include<fstream> #define infile "input.txt" using namespace std; void readfromfile(int numofpeopleandsalary[6][2], int departmentid[50][6], int &counter, int &totalsalary) { int id, depnum, salary, peoplenum; counter = 0; ifstream myfile; myfile.open(infile); if (myfile.fail()) { cout << "did not read file, there problem" << endl; system("pause"); } else { while (!myfile.eof()) { myfile >> id >> depnum >> salary; numofpeopleandsalary[depnum][0] = numofpeopleandsalary[depnum][0] + 1; numofpeopleandsalary[depnum][1] = numofpeopleandsalary[depnum][1] + salary; peoplenum = numofpeopleandsalary[depnum][0]; departmentid[peoplenum][depnum] = id; totalsalary = totalsalar

variables - Error when opening Ruby File (Beginner) + How to run a file? -

when try open ruby file in same directory weird happens, : c:\rubyfiles>file = file.open("lottery.rb", "r") 'file' not recognized internal or external command, operable program or batch file. now know has nothing opening of file itself, wanted have example ;) (this has been resolved^) :d but know how run file itself? can help? in advance! after opening irb, can execute ruby file using kernel#load load 'lottery.rb' if file includes module/class definitions, want load once. kernel#require ensures: require 'lottery.rb'

c# - Simple Example Subquery Linq -

t-sql query select * dbo.user_users userid in (select userid course_enrollments) linq entities alternative of above query var innerquery = en in course_enrollments select en.userid; var query = u in user_users innerquery.contains(u.userid) select u; there alot of complex subqueries on stackoverflow, want see simple example of how simple subquery done via linq.this how done it, not because sends 2 queries database. simple answer use "let" keyword , generate sub-query supports conditional set main entity. var usersenrolledincourses = u in user_users let ces = ce in course_enrollments select ce.userid ces.contains(u.userid) select u; this create exists block in tsql similar to select [extent1].* dbo.user_users extent1 exists (select 1 [c1] dbo.course_enrollements extent2

How can i deal with xml namespace in python? -

i'm not going parse xml file want move in python. (i.e etree) know basic of etree want know xml namespace. i've got 3 namespaces in code. here code want transfer. <?xml version="1.0" encoding="utf-8" standalone="yes"?><ns1:g2smessage xmlns:ns1="http://www.gamingstandards.com/g2s/schemas/v1.0.3"><ns1:g2sbody ns1:datetimesent="2014-08-14t15:30:48.692+09:00" ns1:egmid="testappegmid" ns1:hostid="1"><ns1:communications ns1:deviceid="0" ns1:sessionid="1001" ns1:sessiontype="g2s_request" ns1:timetolive="100" ns1:commandid="1001" ns1:datetime="2014-08-14t06:30:48.696z"><ns1:keepalive/></ns1:communications></ns1:g2sbody></ns1:g2smessage>testappegmid1 does have idea?

javascript - Take element ( ID ) and show it anywhere on page -

this tricky question , have little knowledge of js, well, trying pick element page , show on anywhere calling it. actually, element coming different source in header, , want show in content area. used margin-top -1000px value on different page render on different height of page. in heading overlapping text because can"t make exact on every page. so, looking solution pick element , call in specific area of webpage , hide css <div id="places"> <img src="foo.png"/></div> so, there way pick places webpage , call anywhere in webpage again. thank :) yes, create var stores value , add value other div. the div content: <div id="places"> <img src="foo.png"/></div> the div want display content other div: <div id="my_div"></div> js: $( document ).ready(function() { var places = $('#places').html(); //grab html first div $('#my_div').app

visual studio - Do not recompile not changed files -

when compile application in release mode files recompiling if have no changes. in debug mode changed files recompiling. how fix release compilation? this not normal behaviour vs, had bug not long ago. managed fix deleting all temporary files, deleting release configuration, , recreating it. there's simpler fix, none know of.

python - Numpy Documentation -

what happened http://docs.scipy.org/ ? has been down long time. recommended documentation source alternative? can't if recommended looks correct - http://sourceforge.net/projects/numpy/files/numpy/1.8.1/

php - file_get_contents - blank response (PHPSESSID) -

i'm trying download web page php code. $context_params = array('http' => array('method' => 'get', 'user_agent' => 'mozilla/5.0', 'timeout' => 1, 'header' => "accept-language: en". "cookie: site=blabla1234567cookie; __cf=cookie12345678; phpsessid=phpsessidcookie;")); $context = stream_context_create($context_params); $html = file_get_contents($url, false, $context); web server checks user verifying cookies. have inserted correct client cookies in context, however, file_get_contents returns blank page phpsessid expires(~1 hour?). tried delete phpsessid cookie on web browser, , loaded webpage generated new phpsessid cookie. didn't require relogin tho. tried remove phpsessid cookie on script, file_get_contents returns blank page. i tried check this thread , didn't anyhow. still returns blank page, , can't print context array print_r()/var_

c++ - Isn't BMP in opencv lossless? -

i using opencv c++ test gray images bmp format. here code sample: mat img_cv = imread("test.jpg"); imwrite("aaa.bmp", img_cv); mat img_cv2 = imread("aaa.bmp") since bmp format lossless img_cv , img_cv2 should same, aren't. here output sample, 10x10 gray image; img_cv: 41 41 41 64 64 64 47 47 47 42 29 29 29 36 36 36 60 60 60 57 68 68 68 52 52 52 61 61 61 228 42 42 42 33 33 33 160 160 160 229 47 47 47 68 68 68 128 128 128 171 38 38 38 50 50 50 97 97 97 70 67 67 67 67 67 67 66 66 66 104 104 104 104 105 105 105 99 99 99 95 95 95 95 115 115 115 115 115 115 113 74 74 74 74 74 74 90 90 90 115 img_cv2 41 64 47 42 55 76 197 177 54 62 29 36 60 57 200 248 246 240 160 51 68 52 61 228 248 247 248 242 158 48 42 33 160 229 237 240 244 194 62 43 47 68 128 171 96 113 77 74 66 55 38 50 97 70 98 64 88 69 71 40 67 67 66 104 87 102 98 76 56 57 104 105 99 95 92 107 85 87 60 51 95 115 115 113 109 103 112 99 57 63 74 74 90 115 119 113 124 92 51 47 so doing

ios - Error: Expected a type (NSColor) -

its giving me error of "expected type" on first line, says problem nscolor*. developing ios 7. latest version of xcode , osx. - (nsstring*)colornamefromcolor:(nscolor*)chosencolor { // ... } you developing ios. nscolor not valid type ios, osx. instead use uicolor. - (nsstring*)colornamefromcolor:(uicolor*)chosencolor { // ... }

android - save custom view drawing canvas on orientation change -

i have seen countless examples of people trying save variables in case user flips screen. did not find specific bitmaps or arraylist of paths successful. so ithe idea have drawing app consist of main activity fragment inside. within fragment layout custom view class implement drawing via canvas, bitmaps, , arraylist. have found best way approach parcelables. have seen isn't idea pass bitmaps through. don't know how pass arraylist of paths through since takes general ints, string, etc. simply convert list of path s list of points . arraylist<path> -> arraylist<point> btw, should store point locations in percentages instead of pixel values depending on need. then, recreate list of path s list of point s

html - Text wrapping issues inside of a floated div -

i having trouble getting text on right side of box wrap 2 lines when screen width narrow show of text on 1 line. instead, entire right side bumps down below left. how wrap 2 lines? here's fiddle .box { height: 80px; clear: both; } .left { width: 90px; float: left; margin-right: 8px; height: 80px; border: 1px solid #ccc; } .right { float: left; } all have on .right add width maybe of 40% or , should text wrap pages gets smaller. .right { float: left; width: 40%; }

documentation - How do I reference a documented Python function parameter using Sphinx markup? -

i'd reference previously-documented function parameter elsewhere in python docstring. consider following (admittedly artificial) example: def foo(bar): """perform foo action :param bar: bar parameter """ def nested(): """some nested function depends on enclosing scope's bar parameter. i'd reference function foo's bar parameter here link, possible?""" return bar * bar # ... return nested() is there simple way embed parameter reference using sphinx markup, or happen automagically? (i'm complete sphinx newbie. i've been scanning sphinx docs , haven't found answer question, or example demonstrating proper markup.) i've built extension accomplish task. far seems working standalone html build , additionally readthedocs (after more tweaks). the extension available at: https://pypi.python.org/pypi/sphinx-paramlinks/ . i

wordpress - Stop the footer from showing in my about page? -

i trying have website not show footer on home page (aka front page) , page. if statement have far: <?php if ( !is_front_page()): ?> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="site-info"> <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'sylvieshimmy' ) ); ?>"><?php printf( __( 'proudly powered %s', 'sylvieshimmy' ), 'wordpress' ); ?></a> <span class="sep"> | </span> <?php printf( __( 'theme: %1$s %2$s.', 'sylvieshimmy' ), 'sylvieshimmy', '<a href="http://underscores.me/" rel="designer">underscores.me</a>' ); ?> </div><!-- .site-info --> </footer><!-- #colophon --> <?php endif; ?> how can make footer not show on page well? far wo

android - MediaRecorder, getMaxAmplitude always returns 0 -

i have developed small mediarecorder application. have 3 buttons- play (for start recording), pause (for stop recording), max (for finding max amplitude). googled correct, nothing worked fine me. the problem give me 0 getmaxamplitude . below code using. can 1 please help public class mainactivity extends activity { button play,pause, max; string outputfile = environment.getexternalstoragedirectory(). getabsolutepath() + "/myexampl.3gp"; mediarecorder mrecorder=new mediarecorder(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); play = (button)findviewbyid(r.id.button1); pause= (button)findviewbyid(r.id.button2); max = (button)findviewbyid(r.id.button3); mrecorder = new mediarecorder(); mrecorder.setaudiosource(mediarecorder.audiosource.mic); mrecorder.setoutputformat(mediarec

sql - to retrieve data after last space -

i new oracle. i have column data 'abc def axxxx'. i want have 'axxx' output. could please me this? how regexp_substr? there no need so. can write following query:- select substr('abc def axxxx', instr('abc def axxxx',' ', -1, 1)+1) dual;

vb.net - Updating Classes and function -

assume have class called "myclass" public class myclass end class this class has function called "my function" public class myclass public function myfunction() end function end class this class has been implemented time , been working fine. need change implementation of function "myfunction" . 1 option open source code , change there. i'm guessing there has better approach. inheritance comes mind don't want change derived classes name. want name of class still remain "myclass", i'm guessing code below cause error: public class myclass inherits myclass public function myfunction() end function end class in other words i'm trying create new version of old class keeping of members same changing few functions. to explain project whole, program meant structural design. designs structural components (i.e columns, beams, slabs, ...). design procedures specified 3rd parties (government regulat

Oozie hive action fails -

i creating oozie workflow hive create table command. i have added hive-site.xml in hdfs location. getting below error:- launcher error, reason: main class [org.apache.oozie.action.hadoop.hivemain], main() threw exception, com/facebook/fb303/facebookservice$iface java.lang.noclassdeffounderror: com/facebook/fb303/facebookservice$iface @ java.lang.classloader.defineclass1(native method) this might because missing thrift jar or version mismatch. refer following error while executing program hive jdbc

Adding watermark bitmap over video in android: 4.3's MediaMuxer or ffmpeg -

here scenario: download avi movie web open bitmap resource overlay bitmap @ bottom of movie on frames in background save video on extarnal storage the video length 15 seconds usually is possible achieve using mediamuxer ? info on matter gladly received i've been looking http://bigflake.com/mediacodec/#decodeeditencodetest (thanks @fadden) , says there: "decoding frame , copying bytebuffer glreadpixels() takes 8ms on nexus 5, fast enough keep pace 30fps input, additional steps required save disk png expensive (about half second)" so having 1 sec/frame not acceptable. thinking 1 way save each frame png, open it, add bitmap overlay on , save it. take enormous time accomplish. i wonder if there way things this: open video file external storage start decoding it each decoded frame altered bitmap overlay in memory the frame sent encoder. on ios saw there way take original audio + original video + image , add them in container , encode

cakephp - view content from Controller and view on a separate controller and view -

i have a controller/postscontroller.php model/post.php view/posts/index.ctp if has followed cakephp blog tutorial have completed that. hasnt, site lets add title , comment. forum. now have set , want include new page called home. , on page wont display forum created in smaller container. i unsure how add view of posts new controller/model/view. this postscontroller.php: class postscontroller extends appcontroller { public function index() { $this->set('posts', $this->post->find('all')); } } this view/posts/index.ctp <table> <tr> <th>id</th> <th>title</th> <th>actions</th> <th>created</th> </tr> <!-- here's loop through our $posts array, printing out post info --> <?php foreach ($posts $post): ?> <tr> <td><?php echo $post['post&#

Display only certain list items in listview with javascript -

i have made listview of jquery mobile , it's displaying 4 list items. list generated javascript. $( document ).ready(function() { var data = [{ "name": "lichtbediening", "category": "category", "info": "klik voor lichtbediening", "img": "lichtbediening" }, { "name": "stopcontact", "category": "category", "info": "klik voor stopcontacten", "img": "stopcontacten" }, { "name": "enkele schakelaar", "info": "een knop, een lamp", "img": "rolluikbediening" }, { "name": "dubbele schakelaar", "info": "twee knoppen, twee lampen", "img": "multimedia" }]; var output = ''; $.each(dat

ios - NSLocalizedString for number -

i want translate 1 or 1 chinese or other languages. number can start 0 infinity. how shall translate/show (with nslocalizedstring or other) ? as trojanfoe suggest stick numbers seems opinion. if want translate numbers, can done follows :- nsdecimalnumber *yournumber = [nsdecimalnumber decimalnumberwithstring:@"456"]; nsnumberformatter *formatter = [[nsnumberformatter alloc] init]; nslocale *yourlocale = [[nslocale alloc] initwithlocaleidentifier:@"zh"]; [formatter setlocale: yourlocale]; nslog(@"%@", [formatter stringfromnumber: yournumber]); // logs value in chinese [formatter setlocale:[nslocale currentlocale]]; nslog(@"%@", [formatter stringfromnumber: yournumber]); // logs value in current locale

mysql - The INSERT statement conflicted with the FOREIGN KEY constraint2 -

the insert statement conflicted foreign key constraint "fk_job_posting_client". conflict occurred in database "resland", table "dbo.client", column 'id'. statement has been terminated. i got above exception message while inserting data in job posting screen database design job_posting table is: insert [dbo].[job_posting] ([comp_id] ,[res_id] ,[res_type] ,[contact_name] ,[contact_info] ,[title] ,[descr] ,[prerequisites] ,[skills] ,[job_type] ,[location] ,[duration] ,[post_dt] ,[post_end_dt] ,[positions_cnt] ,[client_id] ,[category] ,[rate] ,[perks] ,[stat] ,[is_deleted] ,[cr_by] ,[dt_cr] ,[mod_by] ,[dt_mod]) in controller wrote code : [validateinput(false)] //[validateantiforgerytoken] [httppost] public actionresult postjob(postjobmodel model, s

python sphinx - Documentation for multi-programming-language API -

i'm part of team working on sdk exposed several programming languages - objc, c#, actionscript, java (android) , later we'll have more languages. we want have documentation made of 2 parts: human readable documentation api reference there links between 2 parts: human readable docs have links specific classes or methods , api reference may link document explain context in class or method used. we use combination of sphinx human readable documentation , language specific tools api such doxygen or asdoc i saw in leapmotion able generate complete documentation multiple programming-language (not human language) cross links between programming-languages. the question does know how accomplish such documentation system in way we'll not have duplicate each change in human readable docs every language , have cross links between languages? i put leap motion documentation. use sphinx create package of docs , breathe, sphinx plug-in, import xml files gene

jquery - Adding functions into existing JqGrid events -

so application uses multiple grids, separated codes 2 files, 1 unique grid, , 1 more common functions shared across grids. now thing is, defined of events in unique files, example, defined loadcomplete event in 1 of grid file because functions unique grid , not other grids. when tried add common loadcomplete functions apply grids in common functions file, wouldn't work me. i can make work if defined common functions in every loadcomplete defeat purpose of separating unique-to-the-grid functions in 1 file , shared functions in file (for maintaining purpose). so i'd know there way add functions in loadcomplete event in common functions file, when loadcomplete event has been applied in every file unique grid itself. i tried following examples got here none seems work me $.jqgrid.extend({}) $(function() {}) (function($){}) jquery.extend(jquery.jgrid.defaults, {}) if read of answers see use little other terminology official jqgrid documentation. name loadco

c# - How do I retrieve the default icon for any given file type in Windows? -

how icon windows uses default specified file type? default icons file type irrespective of whether happen have 1 of these types of files handy , defined in window's registry under hkey_classes_root\ type \defaulticon(default) ...but why tinker when there nice c# code sample here virtualblackfox in answer how common file type icons in c#?

html - Javascript calculation returns NaN, when only first 2 sum inserted -

function kanded_arvutus() { var deebet1 = document.getelementbyid("deebet1").value; var kreedit1 = document.getelementbyid("kreedit1").value; var deebet2 = document.getelementbyid("deebet2").value; var kreedit2 = document.getelementbyid("kreedit2").value; var kokku_deebet = parsefloat(deebet1)+parsefloat(deebet2); document.getelementbyid("kokku_deebet").value = kokku_deebet.tofixed(2); var kokku_kreedit = parsefloat(kreedit1)+parsefloat(kreedit2); document.getelementbyid("kokku_kreedit").value = kokku_kreedit.tofixed(2); } and html <input onclick="kanded_arvutus();" onchange="kanded_arvutus();" type="text" class="form-control" name="deebet'.$i.'" id="deebet'.$i.'" placeholder="0" value=""> <input value="" onclick="kanded_arvutus();" onchange="kan

convert from boolean to byte in java -

i need set byte value method parameter. have boolean variable isgenerated , determines logic executed within method. can pass directly boolean byte parameter not allowed , can't cast in java. solution have looks this: myobj.setisvisible(isgenerated ? (byte)1 : (byte)0); but seems odd me. maybe better solution exists this? your solution correct. if may avoid 1 cast doing following way: myobj.setisvisible((byte) (isgenerated ? 1 : 0 )); additionally should consider 1 of following changes implementation: change method setvisiblitystate(byte state) if need consider more 2 possible states change method setisvisible(boolean value) if method it's looking like

crop polygon from an image using php -

Image
i have map image , want crop selected areas of map using php.i find ways of cropping in rectangles shape.but want polygon shape of source image,and have no idea start. here img i want save pieces of map(whiting area borders) seperate image. after ages of searching.i create polygons want in photoshop.and use them overlays. place overlay images on original image , save new image generated witch croped image wanted .(this procejure done php not photoshop).

sql server - sqlserver stored procedure comment lines in Chinese is garbled -

Image
the red text should chinese garbled.i want know why , how solve it.this in sqlserver2008.look forward reply! in ssms, go to: ‘tools‘ -> ‘options‘ -> ‘environment‘ -> ‘fonts , colors‘ -> select ‘text editor’ and can change font type.

php - Combine two different tables -

i have 3 tables. 1 contains details of items, second contains selling details , third 1 contains purchase details. want create query displays ledger type result. have tried following query giving warning like: current selection not contain unique column. the result table contain column identify table picking values. like, put "p" purchase , "s" sale. i have searched not able find solution in case. here query: select date, itemcode, qty, billno, price, "p" sp purchase itemcode = 1007 union select date, itemcode, qty, billno, rate, "s" billing itemcode = 1007 order date asc select date, itemcode, qty, billno, price, null rate, "p" sp purchase itemcode = 1007 union select date, itemcode, qty, billno, null price, rate, "s" sp billing itemcode =

C# Conditional equivalent of !DEBUG -

this question has answer here: c# !conditional attribute? 6 answers what c# system.diagnostics.conditional equivalent of #if (!debug) ? i want encrypt section of app.config file of console application if has not been compiled in debug mode. achieved so: public static void main(string[] args) { #if (!debug) configencryption.encryptappsettings(); #endif //... } but somehow, prefer decorating encrypt method conditional attribute: [conditional("!debug")] internal static void encryptappsettings() { //... } however makes compiler sad: the argument 'system.diagnostics.conditionalattribute' attribute must valid identifier... what correct syntax negating conditional argument? edit: @gusdor, used (i preferred keep program.cs file free of if/else debug logic): #if !debug #define encrypt_config #endif [conditional("en

MYSQL SELECT random on large table ORDER BY SCORE -

this question has answer here: optimizing mysql statement! - rand() slow 6 answers i have large mysql table 25000 rows. there 5 table fields: id, name, score, age,sex i need select random 5 males order score desc for instance, if there 100 men score 60 each , 100 score 45 each, script should return random 5 first 200 men list of 25000 order rand() is slow the real issue 5 men should random selection within first 200 records. help so use subquery.. way putting rand() on outer query less taxing. from understood question want 200 males table highest score... this: select * table_name age = 'male' order score desc limit 200 now randomize 5 results this. select id, score, name, age, sex ( select * table_name age = 'male' order score desc limit 200 ) t -- written `as t` or else call order rand() limit 5

Write data to Excel - C# -

i need write data excel sheet , need open after writing it. code using.. object misvalue = system.reflection.missing.value; excel.application xlappenv = new excel.applicationclass(); excel.workbook xlforenv = xlappenv.workbooks.add(misvalue); excel.worksheet xlforenv_view = (excel.worksheet)xlforenv.worksheets.get_item(1); xlforenv_view.name = "pf keys"; xlforenv_view.cells[row, column] = "data"; i write data using above code , when done, save file predefined location using below code.. envsaveloc = envsaveloc + "\\pf keys.xlsx"; xlforenv.saveas(envsaveloc, excel.xlfileformat.xlopenxmlworkbook, misvalue, misvalue, misvalue, misvalue, excel.xlsaveasaccessmode.xlexclusive, misvalue, misvalue, misvalue, misvalue, misvalue); xlappenv.displayalerts = true; xlforenv.close(true, misvalue, misvalue); xlappenv.quit(); the above code working fine requirement program shouldn't save once data written excel sheet, open file in excel , present user

struct - How to convert a structure to a byte array in C#? -

how convert structure byte array in c#? i have defined structure this: public struct cifspacket { public uint protocolidentifier; //the value must "0xff+'smb'". public byte command; public byte errorclass; public byte reserved; public ushort error; public byte flags; //here there 14 bytes of data used differently among different dialects. //i want flags2. however, i'll try parsing them. public ushort flags2; public ushort treeid; public ushort processid; public ushort userid; public ushort multiplexid; //trans request public byte wordcount;//count of parameter words defining data portion of packet. //from here might undefined... public int parametersstartindex; public ushort bytecount; //buffer length public int bufferstartindex; public string buffer; } in main method, create instance of , assign values it: cifspacket packet = new cifspacket(); packet.protocolidenti

Using Microsoft Access 2007 database with Visual C# 2010 -

i have finished designing c# application stores employees data in access database. program works when install microsoft office 2007 on machine, causes error if uninstall office 2007. now, wonder if there method enables program connect access database without installing whole microsoft office 2007. using system.data.oledb; if connection string uses microsoft.ace.oledb.12.0 provider need microsoft access database engine installed on client. at link provided find installation of 2 versions of provider. 1 32bit , 1 64bit. the right 1 use depends target cpu defined in app , operating system bitness. of course on 32bit os cannot install 64bit provider while reverse possible. if app compiled x86 target cpu need 32bit version , install app on 64bit systems. if app compiled x64 target cpu need 64bit version , run on 64bit systems. if app compiled any cpu should decide @ install time version of ace.oledb.12.0 install depending on bitness of operating system. if not

Asp.Net services doesn't return response message when I request more than 4 times in android -

i making android application , parsing data asp.net services , when call service more 4 times doesn't return response, didn't data , after waiting 10 minutes services working , can data it. trying 2 weeks , didn't solve it. please me.. code below public class sonrakiactivity extends activity { bundle get_data; int bas_i; textview txt, text2; // button secretbtn; string type; int typeid; int grpid; int id; int sorusayisi = 0; int cevaplanan = 0; boolean hata = false; int akis_soru_sorusayisi = 0; string last_type_inmethod; bundle data_gonder; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.sonraki_olay); txt = (textview) findviewbyid(r.id.textview1); get_data = getintent().getextras(); bas_i = get_data.getint("data_sonraki_soru_id"); data_gonder = new bundle(); gonder(); } public void gonder() { tr