Daily Archives

Articles indexed Tuesday August 19 2014

Page 8/20 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Getting Notifications in Background Mode iOS?

    - by Pau Senabre
    I'm trying to get Notifications in Background Mode by running a method every minute to see if there are new notifications. This works great in Active Mode, but I saw for background mode it is restricted to 7 keys. I enabled the Background Mode with the option Background Fetch, but seems like the method is being called but it's not complete. In AppDelegate I'm calling: - (void)applicationDidEnterBackground:(UIApplication *)application { //This has a Timer to execute every minute [self GetNotifications]; //This executes a NSMutableURLRequest *request //giving back the JSON data with the notifications } I would like to do something like Facebook does for Notifications. Any idea how to do this?

    Read the article

  • get_post_meta return empty string

    - by Jean-philippe Emond
    I guest it is a little issues but I running a SQL to get some post id. $result = $wpdb->get_results("SELECT wppm.post_id FROM wp_postmeta wppm INNER JOIN wp_posts wpp ON wppm.post_id=wpp.ID WHERE wppm.meta_key LIKE 'activity'"); (count: 302) After that, I get all id and I run get_post_meta like that: foreach($result as $id){ $activity = get_post_meta($id); var_dump($activity); foreach($activity as $key=>$value){ if(is_array($value) && $key=="age"){ var_dump($value); } } } (var_dump result: string "") samething if I run with: $activity = get_post_meta($id,'activity',true); Where we need to get a result. What is wrong? Thank you for your help!!! [Bonus Question] If the "activity" meta_key as an array Value. and I get directly like: $result = $wpdb->get_results("SELECT wppm.meta_value FROM wp_postmeta wppm INNER JOIN wp_posts wpp ON wppm.post_id=wpp.ID WHERE wppm.meta_key LIKE 'activity'"); How I parse it? Thanks again!

    Read the article

  • What is wrong in this c++ code?

    - by narayanpatra
    Why this coder do not show error #include <iostream> int main() { using namespace std; unsigned short int myInt = 99; unsigned short int * pMark = 0; cout << myInt << endl; pMark = &myInt; *pMark = 11; cout << "*pMark:\t" << *pMark << "\nmyInt:\t" << myInt << endl; return 0; } But this one shows : #include<iostream> using namespace std; int addnumber(int *p, int *q){ cout << *p = 12 << endl; cout << *q = 14 << endl; } #include<iostream> using namespace std; int addnumber(int *p, int *q){ cout << *p = 12 << endl; cout << *q = 14 << endl; } int main() { int i , j; cout << "enter the value of first number"; cin >> i; cout << "enter the value of second number"; cin >> j; addnumber(&i, &j); cout << i << endl; cout << j << endl; } In both the code snippets, I am assigning *pointer=somevalue. In first code it do not show any error but it shows error in the line cout << *p = 12 << endl; cout << *q = 14 << endl; What mistake I am doing ?

    Read the article

  • Sorting multidimensional array on inner value php [duplicate]

    - by Silver89
    This question already has an answer here: Reference: all basic ways to sort arrays and data in PHP 4 answers Say I have the following array, how can I sort it on sort_by? Array ( [10] => Array ( [Masthead_slide] => Array ( [id] => 1456464564 [sort_by] => 1 ) ) [6] => Array ( [Masthead_slide] => Array ( [id] => 645454 [sort_by] => 10 ) ) [7] => Array ( [Masthead_slide] => Array ( [id] => 4547 [sort_by] => 5 ) ) )

    Read the article

  • Fragment method and socket.io

    - by Tolgay Toklar
    I have a method,this method updates an array list in fragment.I can call this method in main activity like this public void getFromUser(String message) { addMessageToFragment("ok"); } public void addMessageToFragment(String message) { Log.w("Step 1",message); frgObj.addMessageToList("asd"); } getFromUser is calling from fragment(when user presses the button) this is working as well.But I am using socket.io in my app,when I try to call this method from socket.io,app is not working. public void on(String event, IOAcknowledge ack, Object... args) { try{ addMessageToFragment("ok"); } catch (JSONException e) {} } When this callback function calls,app is giving this errors: 08-19 11:57:24.813: W/System.err(4962): io.socket.SocketIOException: Exception was thrown in on(String, JSONObject[]). 08-19 11:57:24.813: W/System.err(4962): Message was: 5:::{"name":"listele","args":[{"mesaj":"123","gonderen":"781722165-tolgay007-DKSMIcIYGahPuKXriM83","alici":"tolgay007","blck_id":"781722165-tolgay007","out_username":"Anony-781722","ars_status":1,"longinf":"3aqghef","a_status":1}]} 08-19 11:57:24.813: W/System.err(4962): at io.socket.IOConnection.transportMessage(IOConnection.java:702) 08-19 11:57:24.813: W/System.err(4962): at io.socket.WebsocketTransport.onMessage(WebsocketTransport.java:82) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:361) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.deliverMessage(WebSocketImpl.java:565) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:331) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:152) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:247) 08-19 11:57:24.823: W/System.err(4962): at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:193) 08-19 11:57:24.823: W/System.err(4962): at java.lang.Thread.run(Thread.java:841) 08-19 11:57:24.823: W/System.err(4962): Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewRootImpl.focusableViewAvailable(ViewRootImpl.java:2800) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.View.setFlags(View.java:8878) 08-19 11:57:24.823: W/System.err(4962): at android.view.View.setFocusableInTouchMode(View.java:6114) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AdapterView.checkFocus(AdapterView.java:718) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:813) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AbsListView$AdapterDataSetObserver.onChanged(AbsListView.java:6280) 08-19 11:57:24.823: W/System.err(4962): at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37) 08-19 11:57:24.823: W/System.err(4962): at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50) 08-19 11:57:24.823: W/System.err(4962): at android.widget.ArrayAdapter.notifyDataSetChanged(ArrayAdapter.java:286) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.ConversationFragment.addMessageToList(ConversationFragment.java:91) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.MainActivity.addMessageToFragment(MainActivity.java:344) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.MainActivity$2.on(MainActivity.java:183) 08-19 11:57:24.823: W/System.err(4962): at io.socket.IOConnection.on(IOConnection.java:908) 08-19 11:57:24.883: W/System.err(4962): at io.socket.IOConnection.transportMessage(IOConnection.java:697) I didn't understand this error.What can be cause this error ?

    Read the article

  • Java threads, wait time always 00:00:00-Producer/Consumer

    - by user3742254
    I am currently doing a producer consumer problem with a number of threads and have had to set priorities and waits to them to ensure that one thread, the security thread, runs last. I have managed to do this and I have managed to get the buffer working. The last thing that I am required to do is to show the wait time of threads that are too large for the buffer and to calculate the average wait time. I have included code to do so, but everything I run the program, the wait time is always returned as 00:00:00, and by extension, the average is returned as the same. I was speaking to one of my colleagues who said that it is not a matter of the code but rather a matter of the computer needing to work off of one processor, which can be adjusted in the task manager settings. He has an HP like myself but his program prints the wait time 180 times, whereas mine prints usually about 3-7 times and is only 00:00:01 on one instance before finishing when I have made the processor adjustments. My other colleague has an iMac and hers puts out an average of 42:00:34(42 minutes??) I am very confused about this because I can see no difference between our codes and like my colleague said, I was wondering is it a computer issue. I am obviously concerned as I wanted to make sure that my code correctly calculated an average wait time, but that is impossible to tell when the wait times always show as 00:00:00. To calculate the thread duration, including the time it entered and exited the buffer was done by using a timestamp import, and then subtracting start time from end time. Is my code correct for this issue or is there something which is missing? I would be very grateful for any solutions. Below is my code: My buffer class package com.Com813cw; import java.text.DateFormat; import java.text.SimpleDateFormat; /** * Created by Rory on 10/08/2014. */ class Buffer { private int contents, count = 0, process = 200; private int totalRam = 1000; private boolean available = false; private long start, end, wait, request = 0; private DateFormat time = new SimpleDateFormat("ss:SSS"); public int avWaitTime =0; public void average(){ System.out.println("Average Application Request wait time: "+ time.format(request/count)); } public synchronized int get() { while (process <= 500) { try { wait(); } catch (InterruptedException e) { } } process -= 200; System.out.println("CPU After Process " + process); notifyAll(); return contents; } public synchronized void put(int value) { if (process <= 500) { process += value; } else { start = System.currentTimeMillis(); try { wait(); } catch (InterruptedException e) { } end = System.currentTimeMillis(); wait = end - start; count++; request += wait; System.out.println("Application Request Wait Time: " + time.format(wait)); process += value; contents = value; calcWait(wait, count); } notifyAll(); } public void calcWait(long wait, int count){ this.avWaitTime = (int) (wait/count); } public void printWait(){ System.out.println("Wait time is " + time.format(this.avWaitTime)); } } My spotify class package com.Com813cw; import java.sql.Timestamp; /** * Created by Rory on 11/08/2014. */ class Spotify extends Thread { private Buffer buffer; private int number; private int bytes = 250; public Spotify(Buffer c, int number) { buffer = c; this.number = number; } long startTime = System.currentTimeMillis(); public void run() { for (int i = 0; i < 20; i++) { buffer.put(bytes); System.out.println(getName() + this.number + " put: " + bytes + " bytes "); try { sleep(1000); } catch (InterruptedException e) { } } long endTime = System.currentTimeMillis(); long timeTaken = endTime - startTime; java.util.Date date = new java.util.Date(); System.out.println("-----------------------------"); System.out.println("Spotify has finished executing."); System.out.println("Time taken to execute was " + timeTaken + " milliseconds"); System.out.println("Time that Spotify thread exited Buffer was " + new Timestamp(date.getTime())); System.out.println("-----------------------------"); } } My BubbleWitch class package com.Com813cw; import java.lang.*; import java.lang.System; import java.sql.Timestamp; /** * Created by Rory on 10/08/2014. */ class BubbleWitch2 extends Thread { private Buffer buffer; private int number; private int bytes = 100; public BubbleWitch2(Buffer c, int number) { buffer = c; this.number=number ; } long startTime = System.currentTimeMillis(); public void run() { for (int i = 0; i < 10; i++) { buffer.put(bytes); System.out.println(getName() + this.number + " put: " + bytes + " bytes "); try { sleep(1000); } catch (InterruptedException e) { } } long endTime = System.currentTimeMillis(); long timeTaken = endTime - startTime; java.util.Date date = new java.util.Date(); System.out.println("-----------------------------"); System.out.println("BubbleWitch2 has finished executing."); System.out.println("Time taken to execute was " +timeTaken+ " milliseconds"); System.out.println("Time Bubblewitch2 thread exited Buffer was " + new Timestamp(date.getTime())); System.out.println("-----------------------------"); } } My Test class package com.Com813cw; /** * Created by Rory on 10/08/2014. */ public class ProducerConsumerTest { public static void main(String[] args) throws InterruptedException { Buffer c = new Buffer(); BubbleWitch2 p1 = new BubbleWitch2(c,1); Processor c1 = new Processor(c, 1); Spotify p2 = new Spotify(c, 2); SystemManagement p3 = new SystemManagement(c, 3); SecurityUpdate p4 = new SecurityUpdate(c, 4, p1, p2, p3); p1.setName("BubbleWitch2 "); p2.setName("Spotify "); p3.setName("System Management "); p4.setName("Security Update "); p1.setPriority(10); p2.setPriority(10); p3.setPriority(10); p4.setPriority(5); c1.start(); p1.start(); p2.start(); p3.start(); p4.start(); p2.join(); p3.join(); p4.join(); c.average(); System.exit(0); } } My security update package com.Com813cw; import java.lang.*; import java.lang.System; import java.sql.Timestamp; /** * Created by Rory on 11/08/2014. */ class SecurityUpdate extends Thread { private Buffer buffer; private int number; private int bytes = 150; private int process = 0; public SecurityUpdate(Buffer c, int number, BubbleWitch2 bubbleWitch2, Spotify spotify, SystemManagement systemManagement) throws InterruptedException { buffer = c; this.number = number; bubbleWitch2.join(); spotify.join(); systemManagement.join(); } long startTime = System.currentTimeMillis(); public void run() { for (int i = 0; i < 15; i++) { buffer.put(bytes); System.out.println(getName() + this.number + " put: " + bytes + " bytes"); try { sleep(1500); } catch (InterruptedException e) { } } long endTime = System.currentTimeMillis(); long timeTaken = endTime - startTime; java.util.Date date = new java.util.Date(); System.out.println("-----------------------------"); System.out.println("Security Update has finished executing."); System.out.println("Time taken to execute was " + timeTaken + " milliseconds"); System.out.println("Time that SecurityUpdate thread exited Buffer was " + new Timestamp(date.getTime())); System.out.println("------------------------------"); } } I'd be grateful as I said for any help as this is the last and most frustrating obstacle.

    Read the article

  • SQL query recursion for a web-like structure

    - by MickeyD
    I have a table here, named "Foo". The data is set up something like this. ID TableReference DataId0 DataId1 DataId2 -- -------------- ------- ------- ------- 1 Prize 3 4 5 2 Prize 4 5 NULL 3 Cash 1 NULL NULL 4 Prize 8 NULL 12 5 Foo 2 3 NULL 6 Cash 8 1 10 7 Foo 5 1 2 Etc. The data is horribly set up, I know, but I didn't set it up that way. :) I'm only dealing with the after effect. I'm trying to come up with a way to essentially "flatten" the table; that is, to display all the data to a point where the table "Foo" does not reference itself. I'm trying to figure out a sql query that I can do to get there. Usually when I deal with recursion, I have (or can establish) parent IDs and set it up that way, but for this table there are seemingly multiple child and parent IDs creating a web-like structure instead of a hierarchy. So I'm at a loss where to even begin to write a sql query for something like this. Note: There is no infinite looping (where one Foo points to another Foo, which points back to the original Foo) from what I've found. Using t-sql. Thanks for any assistance, if at all possible.

    Read the article

  • Instanced drawing with OpenGL ES 2.0

    - by Mårten Wikström
    In short: Is it possible to use the gl_InstanceID built-in variable in OpenGL ES 2.0? And, if so, how? Some more info: I want to draw multiple instances of an object using glDrawArraysInstanced and gl_InstanceID, and I want my application to run on multiple platforms, including iOS. The specification clearly says that these features require ES 3.0. According to the iOS Device Compatibility Reference ES 3.0 is only available on a few devices (those based on the A7 GPU; so iPhone 5s, but not on iPhone 5 or earlier). So my first assumption was that I needed to avoid using instanced drawing on older iOS devices. However, further down in the compatibility reference document it says that the EXT_draw_instanced extension is supported for all SGX Series 5 processors (that includes iPhone 5 and 4s). This makes me think that I could indeed use instanced drawing on older iOS devices too, by looking up and using the appropriate extension function (EXT or ARB) for glDrawArraysInstanced. I'm currently just running some test code using SDL and GLEW on Windows so I haven't tested anything on iOS yet. However, in my current setup I'm having trouble using the gl_InstanceID built-in variable in a vertex shader. I'm getting the following error message: 'gl_InstanceID' : variable is not available in current GLSL version Enabling the "draw_instanced" extension in GLSL has no effect: #extension GL_ARB_draw_instanced : enable #extension GL_EXT_draw_instanced : enable The error goes away when I specifically declare that I need ES 3.0 (GLSL 300 ES): #version 300 es Although that seem to work fine on my Windows desktop machine in an ES 2.0 context I doubt that this would work on an iPhone 5. So, shall I abandon the idea of being able to use instanced drawing on older iOS devices?

    Read the article

  • How to define an angular directive inside an angular directive's link function?

    - by user2316667
    I want to create an angular directive inside of a link function, however; the directive created is not able to be compiled. See this JSFiddle: http://jsfiddle.net/v47uvsj5/5/ Uncommenting this directive in the global space works as expected. app.directive('test', function () { return { templateUrl: 'myform', // wraps script tag with id 'myform' restrict: 'E', require: "^mydir", replace: true, scope: { }, link: function (scope, element, attrs, mydirCtrl) { scope.remove = function () { element.remove(); mydirCtrl.remove(); } } } }); But the exact same code inside the link function fails. The reason I want to do this is because I want the user (who is going to be myself) to be able to provide only a script tag's id via an id attribute to my main directive which will in turn create a 'wrapper' directive with a 'remove' method. This way, in the script tag, all one needs to do is implement the 'remove'.

    Read the article

  • How to add values dynamically to I18n?

    - by Dima Goltsman
    I have many ymls in my rails app, and i want to put some of them in other service, so that i can call this from multiple places. the response of this call will be a hash. {"en" : {"test" : {"text1" : "hi english"}, {"text2" : "mambo number %{num}"} }, "es" : {"test" : {"text1" : "hi espaniol"}, {"text2" : "mamboes numeros %{num}"} } } is there a way i can load that hash into I18n translations like I18n.add_translations(some_hash) so i can access them with I18n.t("test.text1") I18n.t("test.text2", :num => 5) how can i achieve it?

    Read the article

  • Stored procedure to remove FK of a given table

    - by Nicole
    I need to create a stored procedure that: Accepts a table name as a parameter Find its dependencies (FKs) Removes them Truncate the table I created the following so far based on http://www.mssqltips.com/sqlservertip/1376/disable-enable-drop-and-recreate-sql-server-foreign-keys/ . My problem is that the following script successfully does 1 and 2 and generates queries to alter tables but does not actually execute them. In another word how can execute the resulting "Alter Table ..." queries to actually remove FKs? CREATE PROCEDURE DropDependencies(@TableName VARCHAR(50)) AS BEGIN SELECT 'ALTER TABLE ' + OBJECT_SCHEMA_NAME(parent_object_id) + '.[' + OBJECT_NAME(parent_object_id) + '] DROP CONSTRAINT ' + name FROM sys.foreign_keys WHERE referenced_object_id=object_id(@TableName) END EXEC DropDependencies 'TableName' Any idea is appreciated! Update: I added the cursor to the SP but I still get and error: "Msg 203, Level 16, State 2, Procedure DropRestoreDependencies, Line 75 The name 'ALTER TABLE [dbo].[ChildTable] DROP CONSTRAINT [FK__ChileTable__ParentTable__745C7C5D]' is not a valid identifier." Here is the updated SP: CREATE PROCEDURE DropRestoreDependencies(@schemaName sysname, @tableName sysname) AS BEGIN SET NOCOUNT ON DECLARE @operation VARCHAR(10) SET @operation = 'DROP' --ENABLE, DISABLE, DROP DECLARE @cmd NVARCHAR(1000) DECLARE @FK_NAME sysname, @FK_OBJECTID INT, @FK_DISABLED INT, @FK_NOT_FOR_REPLICATION INT, @DELETE_RULE smallint, @UPDATE_RULE smallint, @FKTABLE_NAME sysname, @FKTABLE_OWNER sysname, @PKTABLE_NAME sysname, @PKTABLE_OWNER sysname, @FKCOLUMN_NAME sysname, @PKCOLUMN_NAME sysname, @CONSTRAINT_COLID INT DECLARE cursor_fkeys CURSOR FOR SELECT Fk.name, Fk.OBJECT_ID, Fk.is_disabled, Fk.is_not_for_replication, Fk.delete_referential_action, Fk.update_referential_action, OBJECT_NAME(Fk.parent_object_id) AS Fk_table_name, schema_name(Fk.schema_id) AS Fk_table_schema, TbR.name AS Pk_table_name, schema_name(TbR.schema_id) Pk_table_schema FROM sys.foreign_keys Fk LEFT OUTER JOIN sys.tables TbR ON TbR.OBJECT_ID = Fk.referenced_object_id --inner join WHERE TbR.name = @tableName AND schema_name(TbR.schema_id) = @schemaName OPEN cursor_fkeys FETCH NEXT FROM cursor_fkeys INTO @FK_NAME,@FK_OBJECTID, @FK_DISABLED, @FK_NOT_FOR_REPLICATION, @DELETE_RULE, @UPDATE_RULE, @FKTABLE_NAME, @FKTABLE_OWNER, @PKTABLE_NAME, @PKTABLE_OWNER WHILE @@FETCH_STATUS = 0 BEGIN -- create statement for dropping FK and also for recreating FK IF @operation = 'DROP' BEGIN -- drop statement SET @cmd = 'ALTER TABLE [' + @FKTABLE_OWNER + '].[' + @FKTABLE_NAME + '] DROP CONSTRAINT [' + @FK_NAME + ']' EXEC @cmd -- create process DECLARE @FKCOLUMNS VARCHAR(1000), @PKCOLUMNS VARCHAR(1000), @COUNTER INT -- create cursor to get FK columns DECLARE cursor_fkeyCols CURSOR FOR SELECT COL_NAME(Fk.parent_object_id, Fk_Cl.parent_column_id) AS Fk_col_name, COL_NAME(Fk.referenced_object_id, Fk_Cl.referenced_column_id) AS Pk_col_name FROM sys.foreign_keys Fk LEFT OUTER JOIN sys.tables TbR ON TbR.OBJECT_ID = Fk.referenced_object_id INNER JOIN sys.foreign_key_columns Fk_Cl ON Fk_Cl.constraint_object_id = Fk.OBJECT_ID WHERE TbR.name = @tableName AND schema_name(TbR.schema_id) = @schemaName AND Fk_Cl.constraint_object_id = @FK_OBJECTID -- added 6/12/2008 ORDER BY Fk_Cl.constraint_column_id OPEN cursor_fkeyCols FETCH NEXT FROM cursor_fkeyCols INTO @FKCOLUMN_NAME,@PKCOLUMN_NAME SET @COUNTER = 1 SET @FKCOLUMNS = '' SET @PKCOLUMNS = '' WHILE @@FETCH_STATUS = 0 BEGIN IF @COUNTER > 1 BEGIN SET @FKCOLUMNS = @FKCOLUMNS + ',' SET @PKCOLUMNS = @PKCOLUMNS + ',' END SET @FKCOLUMNS = @FKCOLUMNS + '[' + @FKCOLUMN_NAME + ']' SET @PKCOLUMNS = @PKCOLUMNS + '[' + @PKCOLUMN_NAME + ']' SET @COUNTER = @COUNTER + 1 FETCH NEXT FROM cursor_fkeyCols INTO @FKCOLUMN_NAME,@PKCOLUMN_NAME END CLOSE cursor_fkeyCols DEALLOCATE cursor_fkeyCols END FETCH NEXT FROM cursor_fkeys INTO @FK_NAME,@FK_OBJECTID, @FK_DISABLED, @FK_NOT_FOR_REPLICATION, @DELETE_RULE, @UPDATE_RULE, @FKTABLE_NAME, @FKTABLE_OWNER, @PKTABLE_NAME, @PKTABLE_OWNER END CLOSE cursor_fkeys DEALLOCATE cursor_fkeys END For running use: EXEC DropRestoreDependencies dbo, ParentTable

    Read the article

  • How to split up a long list using \n

    - by pypy
    Here is a long string that I convert to a list so I can manipulate it, and then join it back together. I am having some trouble being able to have an iterator go through the list and when the iterator reach, let us say every 5th object, it should insert a '\n' right there. Here is an example: string = "Hello my name is Josh I like pizza and python I need this string to be really really long" string = string.split() # do the magic here string = ' '.join(string) print(string) Output: Hello my name is Josh I like pizza and python I need this string to be really really long Any idea how i can achieve this? I tried using: for words in string: if words % 5 == 0: string.append('\n') but it doesn't work. What am I missing?

    Read the article

  • Why isn't the pathspec magic :(exclude) excluding the files I specify from git log's output?

    - by Jubobs
    This is a follow-up to Ignore files in git log -p and is also related to Making 'git log' ignore changes for certain paths. I'm using Git 1.9.2. I'm trying to use the pathspec magic :(exclude) to specify that some patches should not be shown in the output of git log -p. However, patches that I want to exclude still show up in the output. Here is minimal working example that reproduces the situation: cd ~/Desktop mkdir test_exclude cd test_exclude git init mkdir testdir echo "my first cpp file" >testdir/test1.cpp echo "my first xml file" >testdir/test2.xml git add testdir/ git commit -m "added two test files" Now I want to show all patches in my history expect those corresponding to XML files in the testdir folder. Therefore, following VonC's answer, I run git log --patch -- . ":(exclude)testdir/*.xml" but the patch for my testdir/test2.xml file still shows up in the output: commit 37767da1ad4ad5a5c902dfa0c9b95351e8a3b0d9 Author: xxxxxxxxxxxxxxxxxxxxxxxxx Date: Mon Aug 18 12:23:56 2014 +0100 added two test files diff --git a/testdir/test1.cpp b/testdir/test1.cpp new file mode 100644 index 0000000..3a721aa --- /dev/null +++ b/testdir/test1.cpp @@ -0,0 +1 @@ +my first cpp file diff --git a/testdir/test2.xml b/testdir/test2.xml new file mode 100644 index 0000000..8b7ce86 --- /dev/null +++ b/testdir/test2.xml @@ -0,0 +1 @@ +my first xml file What am I doing wrong? What should I do to tell git log -p not to show the patch associated with all XML files in my testdir folder?

    Read the article

  • Stata - Multiple rotated plots on graph (including distributions on sides of axes)

    - by meerak
    I would like to produce a single graph containing both: (1) a scatter plot (2) either histograms or kernel density functions of the Y and X variables to the left of the Y axis and below the X axis. I found a graph that does this in MATLAB -- I would just like to produce something similar in Stata: That graph was produced using the following MATLAB code: n = 1000; rho = .7; Z = mvnrnd([0 0], [1 rho; rho 1], n); U = normcdf(Z); X = [gaminv(U(:,1),2,1) tinv(U(:,2),5)]; [n1,ctr1] = hist(X(:,1),20); [n2,ctr2] = hist(X(:,2),20); subplot(2,2,2); plot(X(:,1),X(:,2),'.'); axis([0 12 -8 8]); h1 = gca; title('1000 Simulated Dependent t and Gamma Values'); xlabel('X1 ~ Gamma(2,1)'); ylabel('X2 ~ t(5)'); subplot(2,2,4); bar(ctr1,-n1,1); axis([0 12 -max(n1)*1.1 0]); axis('off'); h2 = gca; subplot(2,2,1); barh(ctr2,-n2,1); axis([-max(n2)*1.1 0 -8 8]); axis('off'); h3 = gca; set(h1,'Position',[0.35 0.35 0.55 0.55]); set(h2,'Position',[.35 .1 .55 .15]); set(h3,'Position',[.1 .35 .15 .55]); colormap([.8 .8 1]); UPDATE: The Stata13 manual entry for "graph combine" has precisely this example (http://www.stata.com/manuals13/g-2graphcombine.pdf). Here is the code: use http://www.stata-press.com/data/r13/lifeexp, clear generate loggnp = log10(gnppc) label var loggnp "Log base 10 of GNP per capita" scatter lexp loggnp, ysca(alt) xsca(alt) xlabel(, grid gmax) fysize(25) saving(yx) twoway histogram lexp, fraction xsca(alt reverse) horiz fxsize(25) saving(hy) twoway histogram loggnp, fraction ysca(alt reverse) ylabel(,nogrid) xlabel(,grid gmax) saving(hx) graph combine hy.gph yx.gph hx.gph, hole(3) imargin(0 0 0 0) graphregion(margin(l=22 r=22)) title("Life expectancy at birth vs. GNP per capita") note("Source: 1998 data from The World Bank Group")

    Read the article

  • Does the ulkJSON library have limitations when dealing with base64 in Delphi 7?

    - by Da Gopherboy
    I'm working on a project that is using Delphi 7 to consume RESTful services. We are creating and decoding JSON with the ulkJSON library. Up to this point I've been able to successfully build and send JSON containing a base64 string that exceed 5,160kb. I can verify that the base64 is being received by the services and verify the integrity of the base64 once its there. In addition to sending, I can also receive and successfully decode JSON with a smaller (~ 256KB or less) base64. However I am experiencing some issues on the return trip when larger (~1,024KB+) base64 is involved for some reason. Specifically when attempting to use the following JSON format and function combination: JSON: { "message" : "/9j/4AAQSkZJRgABAQEAYABgAAD...." } Function: function checkResults(JSONFormattedString: String): String; var jsonObject : TlkJSONObject; iteration : Integer; i : Integer; x : Integer; begin jsonObject := TlkJSONobject.Create; // Validate that the JSONFormatted string is not empty. // If it is empty, inform the user/programmer, and exit from this routine. if JSONFormattedString = '' then begin result := 'Error: JSON returned is Null'; jsonObject.Free; exit; end; // Now that we can validate that this string is not empty, we are going to // assume that the string is a JSONFormatted string and attempt to parse it. // // If the string is not a valid JSON object (such as an http status code) // throw an exception informing the user/programmer that an unexpected value // has been passed. And exit from this routine. try jsonObject := TlkJSON.ParseText(JSONFormattedString) as TlkJSONobject; except on e:Exception do begin result := 'Error: No JSON was received from web services'; jsonObject.Free; exit; end; end; // Now that the object has been parsed, lets check the contents. try result := jsonObject.Field['message'].value; jsonObject.Free; exit; except on e:Exception do begin result := 'Error: No Message received from Web Services '+e.message; jsonObject.Free; exit; end; end; end; As mentioned above when using the above function, I am able to get small (256KB and less) base64 strings out of the 'message' field of a JSON object. But for some reason if the received JSON is larger than say 1,024kb the following line seems to just stop in its tracks: jsonObject := TlkJSON.ParseText(JSONFormattedString) as TlkJSONobject; No errors, no results. Following the debugger, I can go into the library, and see that the JSON string being passed is not considered to be JSON despite being in the format listed above. The only difference I can find between calls that work as expected and calls that do not work as expect appears to be the size of base64 being transmitted. Am I missing something completely obvious and should be shot for my code implementation (very possible)? Have I missed some notation regarding the limitations of the ulkJSON library? Any input would be extremely helpful. Thanks in advance stack!

    Read the article

  • Paramiko ssh output stops at --more--

    - by Anesh
    The output stops printing at --more-- any idea how to get the end of the output >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >>> conn=ssh.connect("ipaddress",username="user", password="pass") >>> channel = ssh.invoke_shell() >>> channel.send("en\n") 3 >>> channel.send("password\n") 9 >>> channel.send("show security local-user-list\n") 30 >>> results = '' >>> channel.send("\n") 1 >>> results += channel.recv(5000) >>> print results bluecoat>en Password: bluecoat#show security local-user-list Default List: local_user_database Append users loaded from file to default list: false local_user_database Lockout parameters: Max failed attempts: 60 Lockout duration: 3600 Reset interval: 7200 Users: Groups: admin_local Lockout parameters: Max failed attempts: 60 Lockout duration: 3600 Reset interval: 7200 Users: <username> Hashed Password: Enabled: true Groups: <username> Hashed Password: Enabled: true **--More--** As you can see above the output stops printing at --more-- any idea how to get the output to print till the end.

    Read the article

  • python-social-auth AuthCanceled exception

    - by vero4ka
    I'm using python-social-auth in my Django application for authentication via Facebook. But when a user tries to login and when it's been refirected to Facebook app page clicks on "Cancel" button, appears the following exception: ERROR 2014-01-03 15:32:15,308 base :: Internal Server Error: /complete/facebook/ Traceback (most recent call last): File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view return view_func(*args, **kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/apps/django_app/utils.py", line 45, in wrapper return func(request, backend, *args, **kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/apps/django_app/views.py", line 21, in complete redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/actions.py", line 54, in do_complete *args, **kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/strategies/base.py", line 62, in complete return self.backend.auth_complete(*args, **kwargs) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/backends/facebook.py", line 63, in auth_complete self.process_error(self.data) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/backends/facebook.py", line 56, in process_error super(FacebookOAuth2, self).process_error(data) File "/home/vera/virtualenv/myapp/local/lib/python2.7/site-packages/social/backends/oauth.py", line 312, in process_error raise AuthCanceled(self, data.get('error_description', '')) AuthCanceled: Authentication process canceled Is the any way to catch it Django?

    Read the article

  • Symfony2 & Twig - theming file upload widget

    - by Sacred Socks
    I have an Symfony2 edit form for an entity and one of the fields is for the user's profile picture. I'm trying to theme the Twig file upload widget so that the current picture set for the field is displayed above the file input. So far, I have: {% form_theme edit_form _self %} {% block field_widget %} {% set type = type|default('text') %} {% if type == 'file' %} <img src="{{ value }}" /> {% endif %} {{ block('form_widget_simple') }} {% endblock %} All works well except that the value variable is blank (which makes sense I guess). My question is how can I get hold of the path to the file? Is there a way to pick it out of the form values for the field? Could I perhaps pass it through as an option to the field? Srz if this is a dumb question, still pretty new to Symfony and Twig..

    Read the article

  • APress Deal of the Day 19/Aug/2014 - Beginning Windows 8

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/19/apress-deal-of-the-day-19aug2014---beginning-windows-8.aspxToday’s $10 Deal of the Day from APress at http://www.apress.com/9781430244318 is Beginning Windows 8. “Beginning Windows 8 is the complete guide to understanding the power and flexibility of Microsoft’s latest operating system to help you get the very best out of your computer.”

    Read the article

  • The Message Queuing service failed to join the computer's domain 'DOMAIN' Error 0xc00e0025

    - by SimonGoldstone
    Struggling to get MSMQ installed in Domain Integration mode on Windows 2012 (Azure). So far, I've provisioned a brand new Windows Server 2012 (R2) machine on the Azure platform and installed the Active Directory role and promoted the machine to a domain controller. Once the AD was in place, I then added the MSMQ feature, along with the Directory Integration add on. However, it will not install in AD integration mode. It will only work in Workgroup mode. I can verify this by running the following powershell command: New-MSMQQueue -name Queue1 -queuetype Public When I run this command, I get the following error: New-MsmqQueue : A workgroup installation computer does not support the operation. The event viewer reveals to errors in the Application log: 1. The Message Queuing service failed to join the computer's domain 'DOMAIN'. Error 0xc00e0025: 2. Message Queuing was unable to create the msmq (MSMQ Configuration) object in Active Directory Domain Services. Error c00e0025h: I'm struggling here. Any advice?

    Read the article

  • Need help translating rate limiting iptables rules to Puppet format

    - by geoffroy
    I use Puppet Iptables module to manage Iptables rules on my machine. I'd like to implement to rate limit failed SSH connections as described here : Hundreds of failed ssh logins iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 5 --name SSH --rsource -j DROP iptables -A INPUT -p tcp --dport 22 -m recent --set --name SSH --rsource -j ACCEPT Is it possible to translate it to Puppet syntax, such as firewall { '015 drop 5 failed attemps to connect to SSH in a minute ': proto => 'tcp', port => 22, action => 'drop', // what are the other paramters ? } Any help welcome. Best regards Geoffroy

    Read the article

  • Error 1935.An error occurred during the installation of assembly 'Microsoft.VC90.CRT,version="9.0.30729.4148"

    - by Milan Aleksic
    I have troubles installing VC runtime libraries to be able to install SQL Server Compact Edition. The same problem causes also other apps to fail when installing, but I chose this one as a good representative example of my problem (and also it's provided by Microsoft, so "installation should work"). I took a look at what is usually provided as logs/more information and I put on Dropbox on this location: https://www.dropbox.com/s/7zh7ajn50cxz7km/logs.zip 2 logs: installation log with more info procmon log of non-success and non-"result not found" while doing the installation step Any idea what could be the cause and how to fix it?

    Read the article

  • Single ipv6 from /64 subnet

    - by PartyPete
    I have a newb question I'd like to ask. We have an dedicated server and we got an ipv6 /64 block. We want to use squid to make proxy and use those IP. And my question now is: Is it possible to use only one IP out of range? for example: let's say I have a range of IPs ffff:ffff::/64, and want to use only one address from it: ffff:ffff::1/128 or ffff:ffff::2/128 but whenever I set squid like this I always get from 'what is my ip' services whole subnet which is again ffff:ffff::. What I want to achieve is to get from those 'what is my ip' services to send me back IP ffff:ffff::1 (or 2 for that matter) Am I doing something wrong?

    Read the article

  • HP DL380 Losing Drive Array

    - by jidl
    I have an HP Proliant DG380 G7 dropping one of it's arrays every hour, on the hour, for 2-5 minutes. The OS is SBS 2011 Standard, the servers runs Exchange, DC, files & Trend WFBS 8. I can watch the D Drive disappear for the duration of the problem - then it just comes back up and all is well again. There is no loss of network connectivity, although the mapped drives also disappear. We thought it might be to do with Sharepoint / VSS writers failing but it looks as though this is a symptom rather than cause. It survives a reboot. Any ideas as to what could be running on a regular schedule like this?

    Read the article

  • Siege - running a stress test benchmark

    - by morgoth84
    I need to do a benchmark test of a HTTPS server using Siege, to see how it behaves under massive load. I'm initiating tests from another machine which is quite powerful and it is connected to the same physical switch the server is connected on. But when I initiate a test, I can't get it to make more than 170 requests per second. With this load the server's CPU usage is at 15-20% and the average response time for a request is approx. 0.03 seconds. Load of the client machine is approx. at 10%. So, I gradually increase the number of users in Siege (the number of worker threads) and request rate linearly increases up to 170 reqs/sec, but it never gets over it. No matter how many more worker threads I start, the load on the server is never more than 20% (and the client's load also doesn't increase any more). How can I overcome this? I've googled a bit and found out that after a request is completed, a socket associated with one ephermal port remains in WAIT_TIME state for some time during which it can't be reused. I tried to overcome this by doing these things: sysctl -w net.ipv4.ip_local_port_range="1024 65535" echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle Oh, and the client machine is a Linux (RedHat, I think, but I'm not sure). Any help would be appreciated.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >