Search Results

Search found 5942 results on 238 pages for 'total starnger'.

Page 189/238 | < Previous Page | 185 186 187 188 189 190 191 192 193 194 195 196  | Next Page >

  • subtotals in columns usind reshape2 in R

    - by user1043144
    I have spent some time now learning RESHAPE2 and plyr but I still do not get it. This time I have a problem with (a) subtotals and (b) passing different aggregate functions . Here an example using data from the excellent tutorial on the blog of mrdwab http://news.mrdwab.com/ # libraries library(plyr) library(reshape2) # get data and add few more variables book.sales = read.csv("http://news.mrdwab.com/data-booksales") book.sales$Stock = book.sales$Quantity + 10 book.sales$SubjCat[(book.sales$Subject == 'Economics') | (book.sales$Subject == 'Management') ] <- '1_EconSciences' book.sales$SubjCat[book.sales$Subject %in% c('Anthropology', 'Politics', 'Sociology') ] <- '2_SocSciences' book.sales$SubjCat[book.sales$Subject %in% c('Communication', 'Fiction', 'History', 'Research', 'Statistics') ] <- '3_other' # to get to my starting dataframe (close to the project I am working on) book.sales1 <- ddply(book.sales, c('Region', 'Representative', 'SubjCat', 'Subject', 'Publisher'), summarize, Stock = sum(Stock), Sold = sum(Quantity), Ratio = round((100 * sum(Quantity)/ sum(Stock)), digits = 1)) #melt it m.book.sales = melt(data = book.sales1, id.vars = c('Region', 'Representative', 'SubjCat', 'Subject', 'Publisher'), measured.vars = c('Stock', 'Sold', 'Ratio')) # cast it Tab1 <- dcast(data = m.book.sales, formula = Region + Representative ~ Publisher + variable, fun.aggregate = sum, margins = c('Region', 'Representative')) Now my questions : I have been able to add the subtotals in rows. But is it possible also to add margins in the columns. Say for example, Totals of Stock for one Publisher ? Sorry I meant to say example total sold for all publishers There is a problem with the columns with “ratio”. How can I get “mean” instead of “sum” for this variable ? P.S: I have seen some examples using reshape. Will you recommend to use it instead of reshape2 (which seems not to include the functionalities of two functions).

    Read the article

  • Out Of Memory error while executing mysqldump

    - by Nishaz Salam
    Hi, I am getting the following error when trying to backup a database using mysqldump from the command prompt. C:\Documents and Settings\bobC:\Adobe\LiveCycle8.2\mysql\bin\mysqldump --quick --add-locks --lock-tables -c --default-character-set=utf8 --skip-opt -pxxxx -u adobe -r C:\Adobe\LiveCycle8.2\configurationManager\working\upgrade\mysql\adobe. sql -B adobe --port=3306 --host=localhost mysqldump: Out of memory (Needed 10380928 bytes) mysqldump: Got error: 2008: MySQL client ran out of memory when retrieving data from server As you can see i am using the --quick and --skip-opt too; cannot figure out what is causing the issue. The server log has the following messages 100420 15:16:39 InnoDB: Error: cannot allocate 4814100 bytes of memory for InnoDB: a BLOB with malloc! Total allocated memory InnoDB: by InnoDB 33427880 bytes. Operating system errno: 2 InnoDB: Check if you should increase the swap file or InnoDB: ulimits of your operating system. InnoDB: On FreeBSD check you have compiled the OS with InnoDB: a big enough maximum process size. 100420 15:16:40 InnoDB: Warning: could not allocate 3814100 + 1000000 bytes to retrieve InnoDB: a big column. Table name adobe/tb_form_data Any help on this regard is highly appreciated P.S: The backup works fine without any issues when i use the MYSQL Administrator, but since an external app( adobe livecycle installer) uses the above command to backup the database during install, i need to get this working. Thanks, Nishaz Salam

    Read the article

  • jmap -histo is missing a lot of memory

    - by ripper234
    I have a JVM with 12 gigs of total RAM, out of which 7 GB is allocated to the old generation. There seems to be some memory leak, because almost the entire old gen is full, and will not release when I schedule a GC (the process is not doing anything else at that time). A jmap -histo dump only reveals less than 1 gigabyte worth of objects. Where are the missing 6 gigs? What better tool do you propose for diagnosing this? Here is the top of the jmap output: num #instances #bytes class name ---------------------------------------------- 1: 429853 68725736 <constMethodKlass> 2: 429853 51594040 <methodKlass> 3: 37503 49611368 <constantPoolKlass> 4: 37503 31109576 <instanceKlassKlass> 5: 191716 28019968 [C 6: 32573 26933152 <constantPoolCacheKlass> 7: 86158 13789560 [I 8: 53532 11244232 [B 9: 284 10507216 [J 10: 137608 7210664 <symbolKlass> 11: 203072 6498304 java.lang.String 12: 10132 5219512 <methodDataKlass> 13: 39694 4128176 java.lang.Class 14: 55713 3792816 [S 15: 61816 3141936 [[I 16: 90109 2883488 java.util.HashMap$Entry

    Read the article

  • Android ANR keyDispatchingTimedOut Error while continuous tapping on screen.

    - by user519846
    Hi All, I am getting Application Not Responding (ANR) dialog while continuous tapping on the screen. There is no view on the screen where i am tapping. Frequency of this issue is less but still i am not able to remove it completely. Here i am attaching the log what i caught during this error. ERROR/ActivityManager(1322): ANR in com.test.mj.and.ui (com.test.mj.and.ui/.TermsAndCondActivity) ERROR/ActivityManager(1322): Reason: keyDispatchingTimedOut ERROR/ActivityManager(1322): Parent: com.test.mj.and.ui/.SplashActivity ERROR/ActivityManager(1322): Load: 6.59 / 6.37 / 5.21 ERROR/ActivityManager(1322): CPU usage from 11430ms to 2196ms ago: ERROR/ActivityManager(1322): rtal.mj.and.ui: 9% = 7% user + 1% kernel / faults: 649 minor ERROR/ActivityManager(1322): system_server: 4% = 2% user + 2% kernel / faults: 10 minor ERROR/ActivityManager(1322): logcat: 3% = 1% user + 1% kernel / faults: 675 minor 1 major ERROR/ActivityManager(1322): synaptics_wq: 1% = 0% user + 1% kernel ERROR/ActivityManager(1322): ami304d: 1% = 0% user + 0% kernel ERROR/ActivityManager(1322): .process.lghome: 1% = 0% user + 0% kernel / faults: 47 minor ERROR/ActivityManager(1322): sync_supers: 0% = 0% user + 0% kernel ERROR/ActivityManager(1322): droid.DunServer: 0% = 0% user + 0% kernel / faults: 6 minor ERROR/ActivityManager(1322): events/0: 0% = 0% user + 0% kernel ERROR/ActivityManager(1322): oid.inputmethod: 0% = 0% user + 0% kernel / faults: 2 minor ERROR/ActivityManager(1322): m.android.phone: 0% = 0% user + 0% kernel / faults: 2 minor ERROR/ActivityManager(1322): ndroid.settings: 0% = 0% user + 0% kernel ERROR/ActivityManager(1322): sh: 0% = 0% user + 0% kernel / faults: 110 minor ERROR/ActivityManager(1322): -flush-179:0: 0% = 0% user + 0% kernel ERROR/ActivityManager(1322): TOTAL: 19% = 13% user + 6% kernel WARN/WindowManager(1322): Continuing to wait for key to be dispatched WARN/WindowManager(1322): No window to dispatch pointer action 1 Can anyone please help me to solve this issue? Thanks in advance.

    Read the article

  • How would I structure the loop to go through inputs?

    - by dmanexe
    I am attempting to make a loop that will go through an array structured like this: $input[n][checked] $input[n][input] The 2nd input acts as a price multiplier, but doesn't have to exist (field can be blank). I don't think a foreach loop is right because I don't think it handles the inputs from the form in the correct dimensional array order to keep the information together. I have inputs on a form that look like this: <input type="checkbox" name="measure[<?php echo $item->id; ?>][checked]" value="<?php echo $item->id; ?>"> <input class="item_mult" type="text" name="measure[<?php echo $item->id; ?>][input]" /> I am attempting to make the loop go through and act as a multiplier on the input relative to its sibling field. (i.e. input[1][input] would be an integer that I want to retrieve later, grouped with input[1][checked]) <? $field = $this->input->post('measure',true); $totals = array(); foreach($field as $value): if ($value['input'] == TRUE) { $query = $this->db->get_where('items', array('id' => $value['input']))->row(); $totals[] = $query->price; ?> <p><?=$query->name?> - <?=money_format('%(#10n', $query->price)?></p> <?php } else { } endforeach; ?> And finally, the last code to array_sum and print the grand total: <? $grand_total = array_sum($totals); ?> <p><?=money_format('%(#10n', $grand_total)?></p> Eventually, I will need to store these records in a database, so I am sending complete item IDs through, etc.

    Read the article

  • SQL: Need help with query construction.

    - by Geeknidas
    Hi Guys, I am relatively new with sql and I need some help with some basic query construction. Problem: To retrieve the number of orders and the customer id from a table based on a set of parameters. I want to write a query to figure out the number of orders under each customer (Column: Customerid) along with the CustomerID where the number of orders should be greater or equal to 10 and the status of the order should be Active. Moreover, I also want to know the first transaction date of an order belonging to each customerid. Table Description: product_orders Orderid CustomerId Transaction_date Status ------- ---------- ---------------- ------- 1 23 2-2-10 Active 2 22 2-3-10 Active 3 23 2-3-10 Deleted 4 23 2-3-10 Active Query that I have written: select count(*), customerid from product_orders where status = 'Active' GROUP BY customerid ORDER BY customerid; The above statement gives me the sum of all order under a customer id but does not fulfil the condition of atleast 10 orders. I donot know how to display the first transaction date along with the order under a customerid (status: could be active or delelted doesn't matter) Ideal solutions should look like: Total Orders CustomerID Transaction Date (the first transaction date) ------------ ---------- ---------------- 11 23 1-2-10 Thanks in advance. I hope you guys would be kind enough to stop by and help me out. Cheers, Leonidas

    Read the article

  • How can I control the width of JTextFields in Java Swing?

    - by Jonas
    I am trying to have several JTextFields on a single row, but I don't want them to have the same width. How can I control the width and make some of them wider than others? I want that they together take up 100% of the total width, so it would be good if I could use some kind of weigthing. I have tried with .setColumns() but it doesn't make sense. Here is my code: class Row extends JComponent { public Row() { this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); JTextField fld1 = new JTextField("First field"); JTextField fld2 = new JTextField("Second field, should be longer"); JTextField fld3 = new JTextField("Short field"); JTextField fld4 = new JTextField("Another field"); fld1.setBorder(null); fld2.setBorder(null); fld3.setBorder(null); fld4.setBorder(null); fld1.setFocusable(false); fld2.setFocusable(false); fld3.setFocusable(false); fld4.setFocusable(false); fld1.setColumns(5); // makes no sense this.add(fld1); this.add(fld2); this.add(fld3); this.add(fld4); } } this.setLayout(new GridLayout(20,0)); this.add(new Row()); this.add(new Row()); this.add(new Row());

    Read the article

  • Mysql query problem

    - by Sergio
    I have a problem with (for me to complicated) MySql query. Okay, here is what I need to do: First I need to check messages that some specific user received $mid=$_SESSION['user']; $stat1=mysql_query("SELECT id, fromid, toid, subject FROM messages WHERE toid = '".$mid."' AND subject != 'not readed' GROUP BY fromid ") or die(mysql_error()); while ($h = mysql_fetch_array($stat1)) { $whosend=$h['fromid']; Second thing that I need to do is check the status of the users (deleted or not) who sent the messages ("fromid") to my specific user ("toid"). This I must do from another table: $stat2=mysql_query("SELECT id, status FROM members WHERE id='".$whosend."' AND status ='1'")or die(mysql_error()); while ($s = mysql_fetch_array($stat)) { Then my problems begin to show up. How can I get the number of the users who sent messages to my specific user with status =1? Not the number of the messages but the total number of the users who sent them. Is there any easier way to do this query? I tried with join tables like $stat=mysql_query("SELECT memebers.id, memebers.status, messages.toid, messages.fromid,messages.subject,messages.id FROM members, messages WHERE messages.toid='".$mid."' AND members.status ='7' .... But even in this query I need to have id's of the user who sent messages before this query so there will be another query before this join tables.

    Read the article

  • WCF Service invalid with Silverlight

    - by Echilon
    I'm trying to get WCF working with Silverlight. I'm a total beginner to WCF but have written asmx services in the past. For some reason when I uncomment more than one method in my service Silverlight refuses to let me use it, saying it is invalid. My code is below if anyone could help. I'm using the Entity Framework if that makes a difference. [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class MessageService {//: IMessageService { /// <summary> /// Sends a new message. /// </summary> /// <param name="recipientUsername">The recipient username.</param> /// <param name="subject">The subject.</param> /// <param name="messageBody">The message body.</param> [OperationContract] public void SendMessageByDetails(string recipientUsername, string subject, string messageBody) { MessageDAL.SendMessage(recipientUsername, subject, messageBody); } /// <summary> /// Sends a new message. /// </summary> /// <param name="msg">The message to send.</param> [OperationContract] public void SendMessage(Message msg) { MessageDAL.SendMessage(msg); } }

    Read the article

  • ploting 3d graph in matlab?

    - by lytheone
    Hello, I am currently a begineer, and i am using matlab to do a data analysis. I have a a text file with data at the first row is formatted as follow: time;wave height 1;wave height 2;....... I have column until wave height 19 and rows total 4000 rows. Data in the first column is time in second. From 2nd column onwards, it is wave height elevation which is in meter. At the moment I like to ask matlab to plot a 3d graph with time on the x axis, wave elevation on the y axis, and wave elevation that correspond to wave height number from 1 to 19, i.e. data in column 2 row 10 has a let say 8m which is correspond to wave height 1 and time at the column 1 row 10. I have try the following: clear; filename='abc.daf'; path='C:\D'; a=dlmread([path '\' filename],' ', 2, 1); [nrows,ncols]=size(a); t=a(1:nrows,1);%define t from text file for i=(1:20), j=(2:21); end wi=a(:,j); for k=(2:4000), l=k; end r=a(l,:); But everytime i use try to plot them, the for loop wi works fine, but for r=a(l,:);, the plot only either give me the last time data only but i want all data in the file to be plot. Is there a way i can do that. I am sorry as it is a bit confusing but i will be very thankful if anyone can help me out. Thank you!!!!!!!!!!

    Read the article

  • Symfony dynamic forms

    - by Asier
    Hi there, I started with a form, which is made by hand because of it's complexity (it's a javascript modified form, with sortable parts, etc). The problem is that now I need to do the validation, and it's a total mess to do it from scratch in the action using the sfValidator* classes. So, I am thinking to do it using sfForm so that my form validation and error handling can be done more easier and so I can reuse this form for the Edit and Create pages. The form is something like this: <form> <input name="form[year]"/> <textarea name="form[description]"></textarea> <div class="sortable"> <div class="item"> <input name="form[items][0][name]"/> <input name="form[items][0][age]"/> </div> <div class="item"> <input name="form[items][1][name]"/> <input name="form[items][1][age]"/> </div> </div> </form> The thing is that the sortable part of the form can be expanded from 2 to N elements on the client side. So that it has variable items quantity which can be reordered. How can I approach this problem? Any ideas are welcome, thank you. :)

    Read the article

  • XML problem in the basic menu example

    - by arakn0
    Hi there, I am trying to create an app with some menus, an I am following the basic example available in the official android site: http://developer.android.com/guide/topics/ui/menus.html My problems appear when I define the menu in the XML. After creating the folder res/menu and creating the menu_option.xml file from eclipse.... The project (in general) gives an error that can be read from the Problems tab: Unparsed aapt error(s)! Check the console for output Android Packaging Problem So, changing to the Console tab to get more information about the problem, this can be read: [2010-06-02 11:35:54 - TestAudio] Error in an XML file: aborting build. [2010-06-02 11:35:54 - TestAudio] W/ResourceType(11566): Bad XML block: header size 63327 or total size -144759824 is larger than data size 0 [2010-06-02 11:35:54 - TestAudio] /home/User/workspace/TestAudio/res/menu/options_menu.xml:1: error: Error parsing XML: no element found The strange thing is that eclipse recognizes the menu items that I've defined in the XML,I can reference them in the code with no problems and my main activity builds. (and the rest of the files too). Could it be that when eclipse creates a file, for some reason, the Android SDK has problems to read it, or something similar?? The XML code is exactly the same as the one in the example, so I don't really know what is happening. The code in options_menu.xml is this: <menu xmlns:android="http://schemas.android.com/apk/res/android" <item android:id="@+id/new_game" android:title="New Game" / <item android:id="@+id/quit" android:title="Quit" / </menu Thanks in advance for your help!

    Read the article

  • Displaying recntangles in game window with XNA

    - by blerh
    I want to divide my game grid into an array of rectangles. Each rectangle is 40x40 and there are 14 rectangles in every column, with a total of 25 columns. This covers a game area of 560x1000. This is the code I have set up to make the first column of rectangles on the game grid: Rectangle[] gameTiles = new Rectangle[15]; for (int i = 0; i <= 15; i++) { gameTiles[i] = new Rectangle(0, i * 40, 40, 40); } I'm pretty sure this works, but of course I cannot confirm it because rectangles do not render on the screen for me to physically see them. What I would like to do for debugging purposes is to render a border, or fill the rectangle with color so I can see it on the game itself, just to make sure this works. Is there a way to make this happen? Or any relatively simple way I can just make sure that this works? Thank you very much.

    Read the article

  • Unable to access Java-created file -- sometimes

    - by BlairHippo
    In Java, I'm working with code running under WinXP that creates a file like this: public synchronized void store(Properties props, byte[] data) { try { File file = filenameBasedOnProperties(props); if ( file.exists() ) { return; } File temp = File.createTempFile("tempfile", null); FileOutputStream out = new FileOutputStream(temp); out.write(data); out.flush(); out.close(); file.getParentFile().mkdirs(); temp.renameTo(file); } catch (IOException ex) { // Complain and whine and stuff } } Sometimes, when a file is created this way, it's just about totally inaccessible from outside the code (though the code responsible for opening and reading the file has no problem), even when the application isn't running. When accessed via Windows Explorer, I can't move, rename, delete, or even open the file. Under Cygwin, I get the following when I ls -l the directory: ls: cannot access [big-honkin-filename] total 0 ?????????? ? ? ? ? ? [big-honkin-filename] As implied, the filenames are big, but under the 260-character max for XP (though they are slightly over 200 characters). To further add to the sense the my computer just wants me to feel stupid, sometimes the files created by this code are perfectly normal. The only pattern I've spotted is that once one file in the directory "locks", the rest are screwed. Anybody ever run into something like this before, or have any insights into what's going on here?

    Read the article

  • How do I exclude data from local table schema_migrations from being pushed to Heroku DB?

    - by Thierry Lam
    I was able to push my Ruby on Rails app with MySQL(local dev) to the Heroku server along with migrating my model with the command heroku rake db:migrate. I have also read the documentation on Database Import/Export. Is that doc referring to pushing actual data from my local dev DB to whichever Heroku's DB? Do I need to modify anything in the file database.yml to make it happen? I ran the following command: heroku db:push and I am getting the error: Sending data 2 tables, 3 records !!! Caught Server Exception | ETA: --:--:-- Taps Server Error: PGError ERROR: duplicate key value violates unique constraint "unique_schema_migrations" I have 2 tables, one I create for my app and the other schema_migrations. The total number of entries among the 2 tables is 3. I'm also printing the number of entries I have in the table I have created and it's showing 0. Any ideas what I might be missing or what I am doing wrong? EDIT: I figured out the above, Heroku's DB already have schema_migrations the moment I ran migrate. New question: Does anyone know how I can exclude data from a specific table from being pushed to Heroku DB. The table to exclude in this case will be schema_migrations. Not so good solution: I googled around and someone else was having the same issue. He suggested naming the schema_migrations table to zschema_migrations. In this way data from the other tables will be pushed properly until it fails on the last table. It's a pretty bad solution but will do for the time being. A better solution will be to use an existing Rails command which can reset a specific table from a database. I don't think Rake can do that.

    Read the article

  • Django FormWizard with dynamic forms

    - by krys
    I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this: class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def __init__(self,*args, **kwargs): user = kwargs['user'] del kwargs['user'] super(BuyAppleForm, self).__init__(*args, **kwargs) credit_cards = get_credit_cards(user) self.fields['creditcard'].choices = [(card.id,str(card)) for card in credit_cards] apple_types= get_types_packages() self.fields['type'].choices = [(type.id,str(type)) for type in apple_types] This will dynamically create a form with lists of available choices. My second form, I actually want no input. I just want to display a confirmation screen containing the credit card info, apple info, and money amounts (total, tax, shipping). Once user clicks OK, I want the apple purchase to commence. I was able to implement the single form way by passing in the request.user object in the kwargs. However, with the FormWizard, I cannot figure this out. Am I approaching the problem wrong and is the FormWizard not the proper way to do this? If it is, how can the Form __init__ method access the user object from the HTTP request?

    Read the article

  • homebrew path issue

    - by Shaun Stanislaus
    Master:~ shaunstanislaus$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) ==> This script will install: /usr/local/bin/brew /usr/local/Library/... /usr/local/share/man/man1/brew.1 Press enter to continue ==> Downloading and Installing Homebrew... remote: Counting objects: 82368, done. remote: Compressing objects: 100% (39323/39323), done. remote: Total 82368 (delta 56782), reused 65301 (delta 42220) Receiving objects: 100% (82368/82368), 11.68 MiB | 1.59 MiB/s, done. Resolving deltas: 100% (56782/56782), done. From https://github.com/mxcl/homebrew * [new branch] master -> origin/master HEAD is now at 2ea1a0e smpeg: depends on gtk ==> Installation successful! You should run `brew doctor' *before* you install anything. Now type: brew help Master:~ shaunstanislaus$ brew doctor -bash: /usr/local/bin/brew: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory Master:~ shaunstanislaus$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/shaunstanislaus/Library/Application Support/GoodSync:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/Users/shaunstanislaus/.ec2/bin:/Users/shaunstanislaus/.rvm/bin /usr/local/bin/brew: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory how do i fix this path issue? i can't use brew command and i think i previously symlink to wrong location. please advice, thank you.

    Read the article

  • Encryption puzzle / How to create a PassStub for a Remote Assistance ticket

    - by Jon Clegg
    I am trying to create a ticket for Remote Assistance. Part of that requires creating a PassStub parameter. As of the documentation: http://msdn.microsoft.com/en-us/library/cc240115(PROT.10).aspx PassStub: The encrypted novice computer's password string. When the Remote Assistance Connection String is sent as a file over e-mail, to provide additional security, a password is used.<16 In part 16 they detail how to create as PassStub. In Windows XP and Windows Server 2003, when a password is used, it is encrypted using PROV_RSA_FULL predefined Cryptographic provider with MD5 hashing and CALG_RC4, the RC4 stream encryption algorithm. As PassStub looks like this in the file: PassStub="LK#6Lh*gCmNDpj" If you want to generate one yourself run msra.exe in Vista or run the Remote Assistance tool in WinXP. The documentation says this stub is the result of the function CryptEncrypt with the key derived from the password and encrypted with the session id (Those are also in the ticket file). The problem is that CryptEncrypt produces a binary output way larger then the 15 byte PassStub. Also the PassStub isn't encoding in any way I've seen before. Some interesting things about the PassStub encoding. After doing statistical analysis the 3rd char is always a one of: !#$&()+-=@^. Only symbols seen everywhere are: *_ . Otherwise the valid characters are 0-9 a-z A-Z. There are a total of 75 valid characters and they are always 15 bytes. Running msra.exe with the same password always generates a different PassStub, indicating that it is not a direct hash but includes the rasessionid as they say. Some other ideas I've had is that it is not the direct result of CryptEncrypt, but a result of the rasessionid in the MD5 hash. In MS-RA (http://msdn.microsoft.com/en-us/library/cc240013(PROT.10).aspx). The "PassStub Novice" is simply hex encoded, and looks to be the right length. The problem is I have no idea how to go from any hash to way the PassStub looks like.

    Read the article

  • transactions and delete using fluent nhibernate

    - by Will I Am
    I am starting to play with (Fluent) nHibernate and I am wondering if someone can help with the following. I'm sure it's a total noob question. I want to do: delete from TABX where name = 'abc' where table TABX is defined as: ID int name varchar(32) ... I build the code based on internet samples: using (ITransaction transaction = session.BeginTransaction()) { IQuery query = session.CreateQuery("FROM TABX WHERE name = :uid") .SetString("uid", "abc"); session.Delete(query.List<Person>()[0]); transaction.Commit(); } but alas, it's generating two queries (one select and one delete). I want to do this in a single statement, as in my original SQL. What is the correct way of doing this? Also, I noticed that in most samples on the internet, people tend to always wrap all queries in transactions. Why is that? If I'm only running a single statement, that seems an overkill. Do people tend to just mindlessly cut and paste, or is there a reason beyond that? For example, in my query above, if I do manage it to get it from two queries down to one, i should be able to remove the begin/commit transaction, no? if it matters, I'm using PostgreSQL for experimenting.

    Read the article

  • Codeigniter Pagination: Run the Query Twice?

    - by Frank
    I'm using codeigniter and the pagination class. This is such a basic question, but I need to make sure I'm not missing something. In order to get the config items necessary to paginate results getting them from a MySQL database it's basically necessary to run the query twice is that right? In other words, you have to run the query to determine the total number of records before you can paginate. So I'm doing it like: Do this query to get number of results $this->db->where('something', $something); $query = $this->db->get('the_table_name'); $num_rows = $query->num_rows(); Then I'll have to do it again to get the results with the limit and offset. Something like: $this->db->where('something', $something); $this->db->limit($limit, $offset); $query = $this->db->get('the_table_name'); if($query->num_rows()){ foreach($query->result_array() as $row){ ## get the results here } } I just wonder if I'm actually doing this right in that the query always needs to be run twice? The queries I'm using are much more complex than what is shown above.

    Read the article

  • How do I make the following interaction with mySQL more efficient?

    - by Travis
    I've got an array that contains combinations of unique MySql IDs: For example: [ [1,10,11], [2,10], [3,10,12], [3,12,13,20], [4,12] ] In total there are a couple hundred different combinations of IDs. Some of these combinations are "valid" and some are not. For example, [1,10,11] may be a valid combination, whereas [3,10,12] may be invalid. Combinations are valid or invalid depending on how the data is arranged in the database. Currently I am using a SELECT statement to determine whether or not a specific combination of IDs is valid. It looks something like this: SELECT id1 FROM table WHERE id2 IN ($combination) GROUP BY id1 HAVING COUNT(distinct id2) = $number ...where $combination is one possible combination of IDs (eg 1,10,11) and $number is the number of IDs in that combination (in this case, 3). An invalid combination will return 0 rows. A valid combination will return 1 or more rows. However, to solve the entire set of possible combinations means looping a couple hundred SELECT statements, which I would rather not be doing. I am wondering: Are there any tricks for making this more efficient? Is it possible to submit the entire dataset to mySQL in one go, and have mySQL iterate through it? Any suggestions would be much appreciated. Thanks in advance!

    Read the article

  • How to compile Open Flash Chart v.1?

    - by geehertush01
    Let me just say, that I'm a total beginner in anything related to flash. I would like to compile latest version of OFC1 (v.1.9.7). It can be downloaded here: link. Unfortunately no tutorial of how to do it can be found anywhere. I succeeded in compiling OFC2 (v.Lug-Wyrm-Charmer). I installed FlashDevelop, then I found .proj file in the OFC2 package, opened it in FlashDevelop and built the project. It worked fine (although I had to fix some code errors, but it was simple). Unfortunately there is no project file in OFC1 package. I tried to create a new project (Project-New Project-AS3 Project). It created .proj file and few folders (src,bin...). I deleted 'Main.as' from 'src' folder. Then I copied all files from 'actionscript' folder from OFC1 to 'src' project folder. I opened the project and set 'open-flash-char.as' as Document Class (right click on the file in the project tree and 'Set Document Class'). Then I tried to build the project, but got an syntax error with (in 'open-flash-char.as'): #include "prototype.drawCircle.as" #include "prototype.fillCircle.as" #include "String.prototype.replace.as" So I removed "#" signs. But then I got an error ...\ofc1\projtest4\src\open-flash-chart.as: Error: A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package. I have no idea of how to continue. Maybe I'm doing everything wrong, because OFC1 is written in AS2 (probably), not AS3. I don't know. So my question is: How to compile OFC v.1.9.7?

    Read the article

  • MS SQL : Can you help me with this query?

    - by rlb.usa
    I want to run a diagnostic report on our MS SQL 2008 database server. I am looping through all of the databases, and then for each database, I want to look at each table. But, when I go to look at each table (with tbl_cursor), it always picks up the tables in the database 'master'. I think it's because of my tbl_cursor selection : SELECT table_name FROM information_schema.tables WHERE table_type = 'base table' How do I fix this? Here's the entire code: SET NOCOUNT ON DECLARE @table_count INT DECLARE @db_cursor VARCHAR(100) DECLARE database_cursor CURSOR FOR SELECT name FROM sys.databases where name<>N'master' OPEN database_cursor FETCH NEXT FROM database_cursor INTO @db_cursor WHILE @@Fetch_status = 0 BEGIN PRINT @db_cursor SET @table_count = 0 DECLARE @table_cursor VARCHAR(100) DECLARE tbl_cursor CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_type = 'base table' OPEN tbl_cursor FETCH NEXT FROM tbl_cursor INTO @table_cursor WHILE @@Fetch_status = 0 BEGIN DECLARE @table_cmd NVARCHAR(255) SET @table_cmd = N'IF NOT EXISTS( SELECT TOP(1) * FROM ' + @table_cursor + ') PRINT N'' Table ''''' + @table_cursor + ''''' is empty'' ' --PRINT @table_cmd --debug EXEC sp_executesql @table_cmd SET @table_count = @table_count + 1 FETCH NEXT FROM tbl_cursor INTO @table_cursor END CLOSE tbl_cursor DEALLOCATE tbl_cursor PRINT @db_cursor + N' Total Tables : ' + CAST( @table_count as varchar(2) ) PRINT N'' -- print another blank line SET @table_count = 0 FETCH NEXT FROM database_cursor INTO @db_cursor END CLOSE database_cursor DEALLOCATE database_cursor SET NOCOUNT OFF

    Read the article

  • NHibernate CreateSqlQuery and object graph

    - by magellings
    Hello I'm a newbie to NHibernate. I'd like to make one sql query to the database using joins to my three tables. I have an Application with many Roles with many Users. I'm trying to get NHibernate to properly form the object graph starting with the Application object. For example, if I have 10 application records, I want 10 application objects and then those objects have their roles which have their users. What I'm getting however resembles a Cartesian product in which I have as many Application objects as total User records. I've looked into this quite a bit and am not sure if it is possible to form the application hierarchy correctly. I can only get the flattened objects to come back. It seems "maybe" possible as in my research I've read about "grouped joins" and "hierarchical output" with an upcoming LINQ to NHibernate release. Again though I'm a newbie. [Update Based on Frans comment in Ayende's post here I'm guessing what I want to do is not possible http://ayende.com/Blog/archive/2008/12/01/solving-the-select-n1-problem.aspx ] Thanks for you time in advance. Session.CreateSQLQuery(@"SELECT a.ID, a.InternalName, r.ID, r.ApplicationID, r.Name, u.UserID, u.RoleID FROM dbo.[Application] a JOIN dbo.[Roles] r ON a.ID = r.ApplicationID JOIN dbo.[UserRoleXRef] u ON u.RoleID = r.ID") .AddEntity("app", typeof(RightsBasedSecurityApplication)) .AddJoin("role", "app.Roles") .AddJoin("user", "role.RightsUsers") .List<RightsBasedSecurityApplication>().AsQueryable();

    Read the article

  • Conditional macro expansion

    - by Dave DeLong
    Heads up: This is a weird question. I've got some really useful macros that I like to use to simplify some logging. For example I can do Log(@"My message with arguments: %@, %@, %@", @"arg1", @"arg2", @"arg3"), and that will get expanded into a more complex method invocation that includes things like self, _cmd, __FILE__, __LINE__, etc, so that I can easily track where things are getting logged. This works great. Now I'd like to expand my macros to not only work with Objective-C methods, but general C functions. The problem is the self and _cmd portions that are in the macro expansion. These two parameters don't exist in C functions. Ideally, I'd like to be able to use this same set of macros within C functions, but I'm running into problems. When I use (for example) my Log() macro, I get compiler warnings about self and _cmd being undeclared (which makes total sense). My first thought was to do something like the following (in my macro): if (thisFunctionIsACFunction) { DoLogging(nil, nil, format, ##__VA_ARGS__); } else { DoLogging(self, _cmd, format, ##__VA_ARGS__); } This still produces compiler warnings, since the entire if() statement is substituted in place of the macro, resulting in errors with the self and _cmd keywords (even though they will never be executed during function execution). My next thought was to do something like this (in my macro): if (thisFunctionIsACFunction) { #define SELF nil #define CMD nil } else { #define SELF self #define CMD _cmd } DoLogging(SELF, CMD, format, ##__VA_ARGS__); That doesn't work, unfortunately. I get "error: '#' is not followed by a macro parameter" on my first #define. My other thought was to create a second set of macros, specifically for use in C functions. This reeks of a bad code smell, and I really don't want to do this. Is there some way I can use the same set of macros from within both Objective-C methods and C functions, and only reference self and _cmd if the macro is in an Objective-C method?

    Read the article

< Previous Page | 185 186 187 188 189 190 191 192 193 194 195 196  | Next Page >